Mcq
Mcq
Mcq
A)Class
b)Constructor
c)VAriable
d)Method
ANS: B
}
}
Choose from below a valid option to complete the above code, in the order
as it appear, that will give the output as MAT
A) int x= str.charAt(i)-32,
System.out.print({char}x);
B)int x=str.chatAt(i)+32,
System.out.print(x);
C)char c=str.charAt(i)-32,
System.out.print(c);
D)int x=str.charAt(i)-32,
System.out.print(x);
ANS: A
ANS: A
ANS: A
ANS: A
ANS: C
ANS: C
A)new int[intArray.length]
intArray.length
intArray[i].length
intArray[i][j]
B)new int[intArray.length]
intArray.length
intArray.length
intArray[i][j]
C)new int[intArray.length]
intArray.length
intArray.length
intArray[j][i]
D)new int[][intArray.length]
intArray.length
intArray[i].length
intArray[i][j]
ANS: A
ANS: C
ANS: A
ANS: BCD
Thread.sleep(2000);
System.out.println("Accenture");
}
}
ANS: C
A)Java.lang.Execptionhandled
B)Compilation Error
C)Java.io.IOExceptionhandled
D)Java.io.IOExceptionhandled
Java.lang.Exceptionhandled
ANS: B
15.Consider below code snippet what other values can be added to mySet
without the program causing any errors. Select all that apply
public static void main(String[] args){
Set mySet= new HashSet();
mySet.add("Z");
mySet.add("P");
mySet.add("M");
}
A)mySet.add(null);
B)mySet.add(12.56);
C)mySet.add("A");
D)mySet.add(false);
ANS: All
ANS: B
ANS: A,D
18. Consider the following program and choose the best option
A)when executed, it prints one of the following: Run! Eat! Relax! or Run!
Relax! Eat!
B)when executed, it prints one of the following: Eat! Run! Relax! or Run!
Eat! Relax!
C)when executed, it prints one of the following: Eat! Run! Relax!;Run!
Eat! Relax! or Relax! Eat! Run!
D)The program results in computer error(s)
ANS: B
ANS: C
A) A
B) demo
C) Compilation error
D) runtime error
ANS: B