Converted Text
Converted Text
(MCQs)
a) Data type
b) Blueprint
c) Operator
d) Loop
**Answer:** b) Blueprint
a) Copies
b) Instances
c) Methods
d) Constructors
**Answer:** b) Instances
b) ==
c) !=
d) &&
**Answer:** b) ==
a) String
b) Integer
c) Boolean
d) Float
**Answer:** c) Boolean
a) 7/2
b) 7%2
c) 7*2
d) 7-2
**Answer:** b) 7%2
a) java.io
b) java.math
c) java.util
d) java.lang
**Answer:** c) java.util
a) nextDouble()
b) nextInt()
c) nextLine()
d) nextChar()
**Answer:** b) nextInt()
b) 8
c) 9
d) 10
**Answer:** b) 8
a) Upward
b) Downward
**Answer:** a) Upward
a) return
b) stop
c) break
d) exit
**Answer:** c) break
11. The loop that executes at least once, even if the condition is false, is:
a) for
b) while
c) do-while
d) nested loop
**Answer:** c) do-while
a) !
b) ~
c) ^
d) ||
**Answer:** a) !
b) 0
c) 15
d) -1
**Answer:** c) 15
a) 4
b) 10
c) 0
d) -6
**Answer:** a) 4
a) for
b) if-else
c) while
d) do-while
**Answer:** b) if-else
b) Plagiarism
c) Innovation
d) Debugging
**Answer:** b) Plagiarism
19. The default data type for decimal values in Java is:
a) float
b) double
c) int
d) long
**Answer:** b) double
20. A nested `for` loop with 3 iterations in the outer loop and 4 iterations in the inner loop will
execute __________ times in total.
a) 3
b) 4
c) 7
d) 12
**Answer:** d) 12
21. The `switch` statement works with which of the following data types?
a) int
b) char
c) String
a) +
b) =
c) &
d) ||
**Answer:** a) +
b) false
c) 1
d) 0
**Answer:** b) false
24. The method used to read a double value using the `Scanner` class is:
a) nextDouble()
b) nextFloat()
c) nextInt()
d) nextLine()
**Answer:** a) nextDouble()
25. To skip the current iteration of a loop and move to the next, we use:
a) break
b) stop
c) exit
d) continue
**Answer:** d) continue
b) 0 and 100
c) 1 and 10
d) -1 and 1
a) class
b) object
c) define
d) new
**Answer:** a) class
28. The loop that is most suitable when the number of iterations is known is:
a) while
b) for
c) do-while
d) infinite loop
**Answer:** b) for
a) 12
b) 25
c) 0
d) -13
**Answer:** b) 25
a) 1
b) 3
c) 10
d) 0
**Answer:** a) 1
a) +
b) **
c) /
d) %
**Answer:** b) **
a) continue
b) break
c) return
d) exit
**Answer:** b) break
b) Upward
**Answer:** a) Downward
a) 18
b) 14
c) 13
d) 9
**Answer:** b) 14
a) /* */
b) //
c) #
d) <!-- -->
**Answer:** b) //
a) 4
b) 8
c) 16
d) 2
**Answer:** a) 4
37. To read a string from the user, the `Scanner` class method used is:
a) next()
b) nextLine()
c) nextString()
d) readString()
**Answer:** b) nextLine()
b) 0
c) true
d) false
**Answer:** d) false
a) &&
b) ||
c) ?:
d) ==
**Answer:** c) ?:
a) Hello30
b) Hello1020
c) 30Hello
d) Compilation error
**Answer:** b) Hello1020
a) float f = 1.0;
b) float f = 1.0F;
c) float f = "1.0";
d) float f = '1.0';
a) default case
b) break statement
c) case statement
d) condition in parentheses
a) class
b) object
c) new
d) define
**Answer:** c) new
46. What is the result of `10 / 3` in Java when both are integers?
a) 3.33
b) 3
c) 10
d) 0
**Answer:** b) 3
a) printf()
b) format()
c) println()
d) print()
**Answer:** a) printf()
b) 0
c) Infinity
d) -1
**Answer:** b) 0
a) char
b) byte
c) short
d) real
**Answer:** d) real
a) exit()
b) stop()
c) System.exit()
d) terminate()
**Answer:** c) System.exit()