Mcqsmid 1
Mcqsmid 1
Which component is used to compile, debug and execute the java programs?
a) JRE
b) JIT
c) JDK
d) JVM
Ans: d
What is the stored in the object obj in following lines of Java code?
box obj;
a) Memory address of allocated memory of object
b) NULL
c) Any arbitrary pointer
d) Garbage
Ans: b
Which of the following is a valid declaration of an object of class Box?
a) Box obj = new Box();
b) Box obj = new Box;
c) obj = new Box();
d) new Box obj;
Ans: a
Which of this method is given parameter via command line arguments?
a) main()
b) recursive() method
c) Any method
d) System defined methods
Ans: a
Which of these data types is used to store command line arguments?
a) Array
b) Stack
c) String
d) Integer
Ans: C
How many arguments can be passed to main()?
a) Infinite
b) Only 1
c) System Dependent
d) None of the mentioned
Ans: a
Which of these is a correct statement about args in the following line of code?
public static void main(String args[])
a) args is a String
b) args is a Character
c) args is an array of String
d) args in an array of Character
Ans: c
What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
a) Integer
b) Floating – point numbers
c) Boolean
d) None of the mentioned
Ans: C
Which of these is an incorrect array declaration?
a) int arr[] = new int[5]
b) int [] arr = new int[5]
c) int arr[] = new int[5]
d) int arr[] = int [5] new
Ans: a
Which of the following is not a valid flow control statement?
A. continue
B. Break
C. Return
D. Exit()
E. None of these
Ans: D
From where break statement causes an exit?
A. Only from innermost switch
B. From innermost loops or switches
C. Terminates a program
D. Only from innermost loop
Ans: B
9. Which of the following loops will execute the body of loop even when condition controlling the
loop is initially false?