Java Programming MCQs [set-1]
1. Who is considered as the creator of JAVA ?
A. Dennis Richie
B. Ken Thompson
C. James Gosling
D. Bjarne Stroupstrup
o m
.c
Answer: C
te
a
M
2. Which of the following statements about the Java language is true?
q
c
A. Java supports only Procedural Oriented Programming approach
M
B. Both Procedural and Object Oriented Programming are supported in Java
C. Java supports only Object Oriented Programming approach
D. None of the Above
Answer: C
3. JRE stands for
A. Java Realtime Environment
B. Java Rapid Enterprise
C. Java Runtime Environment
D. None of the above
Answer: C
4. Java source files are compiled and converted to
A. Object code
B. machine code
Download more at McqMate.com
C. Bytecode
D. executable file
Answer: C
5. JVM is ___________for bytecode.
A. a compiler
B. an interpreter
C. assembler
o m
D. none of the above
.c
te
Answer: B
a
q M
6. What is the size of int data type in java?
c
A. 1 bytes M
B. 2 bytes
C. 4 bytes
D. 8 bytes
Answer: C
7. Which is a valid float literal?
A. 1.23
B. 2
C. 1.23d
D. 1.23f
Answer: D
8. What is the numerical range of a char in Java?
A. -128 to 127
Download more at McqMate.com
B. 0 to 256
C. 0 to 32767
D. 0 to 65535
Answer: D
9. Which of these coding types is used for data type char in Java?
A. ASCII
B. ISO-LATIN-1
o m
C. UNICODE
.c
te
D. None of the mentioned
a
Answer: C
q M
c
M
10. Which of these values can a boolean variable contain?
A. True & False
B. 0 & 1
C. Any integer value.
D. Both a & b
Answer: A
11. Which one of the following is a valid identifier in java?
A. x1
B. 1x
C. $x
D. x 1
Answer: A
12. Which operator is used to implement unsigned right shift of an
integer?
Download more at McqMate.com
A. <<
B. >>
C. <<<
D. >>>
Answer: D
13. Which one of the following is a jump statement in java?
A. goto
o m
B. jump
.c
te
C. break
a
D. if
q M
Answer: C
c
M
14. Which of these operators is used to allocate memory to array variable
in Java?
A. malloc
B. alloc
C. new
D. new malloc
Answer: C
15. Which of the following loops will execute the body of loop even when
condition controlling the loop is initially false?
A. do-while
B. while
C. for
D. None of the mentioned
Answer: A
Download more at McqMate.com
16. Which of these is necessary condition for automatic type conversion in
Java?
A. The destination type is smaller than source type.
B. The destination type is larger than source type.
C. The destination type can be larger or smaller than source type.
D. None of the mentioned
Answer: B
o m
.c
17. What is the error in this code? byte b = 50; b = b * 50;
te
a
A. b can not store the result 2500, limited by its range.
q M
B. * operator has converted b * 50 into int, which can not be converted to byte without casting.
c
C. b can not contain value 50.
D. No error in this code
M
Answer: B
18. Which of these is an incorrect array declaration?
A. int arr[] = new int[5];
B. int [] arr = new int[5];
C. int arr[]; arr = new int[5];
D. int arr[] = int [5] new
Answer: D
19. Which of these selection statements test only for equality?
A. if
B. switch
C. Both a & b
D. None of the mentioned
Answer: B
Download more at McqMate.com
20. Which of these are selection statements in Java?
A. if
B. for
C. continue
D. all of these
Answer: A
21. Which of these jump statements can skip o
m
code in its body for a particular iteration? .c processing remainder of
te
a
A. break
q M
B. return
c
C. exit
D. continue
M
Answer: D
22. What is the value of the expression 2 & 3 ?
A. 2
B. 3
C. 6
D. 5
Answer: A
23. What is the value of the expression 8 << 2 ?
A. 2
B. 32
C. 1 6
D. 5
Answer: B
Download more at McqMate.com
24. The keyword used to create a constant variable
A. const
B. static
C. final
D. none of these
Answer: C
m
olines of code? box obj;
c
25. What is stored in the object obj in following
.
e
at
A. Memory address of allocated memory of object.
B. NULL
q M
C. Any arbitrary pointer
c
D. Garbage M
Answer: B
Download more at McqMate.com
Take Quick Mock/Practice test on this topic HERE
For Discussion / Reporting / Correction of any MCQ please visit discussion page by clicking on
'answer' of respective MCQ.
McqMate is also available on
PlayStore
o m
.c
te
a
q M
c
M
Download more at McqMate.com