0% found this document useful (0 votes)
15 views21 pages

Converted Text

Lorem ips

Uploaded by

sujatasaha013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views21 pages

Converted Text

Lorem ips

Uploaded by

sujatasaha013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Computer Applications Annual Objectives

(MCQs)

1. A class is a __________ in Java.

a) Data type

b) Blueprint

c) Operator

d) Loop

**Answer:** b) Blueprint

2. Objects are __________ of a class.

a) Copies

b) Instances

c) Methods

d) Constructors

**Answer:** b) Instances

3. Which operator is used to check equality in Java?


a) =

b) ==

c) !=

d) &&

**Answer:** b) ==

4. Relational operators always return a __________ value.

a) String

b) Integer

c) Boolean

d) Float

**Answer:** c) Boolean

5. The remainder of 7 divided by 2 is given by:

a) 7/2

b) 7%2

c) 7*2
d) 7-2

**Answer:** b) 7%2

6. The `Scanner` class is part of the __________ package.

a) java.io

b) java.math

c) java.util

d) java.lang

**Answer:** c) java.util

7. Which method reads integer input using the `Scanner` class?

a) nextDouble()

b) nextInt()

c) nextLine()

d) nextChar()

**Answer:** b) nextInt()

8. The output of `Math.pow(2, 3)` is:


a) 6

b) 8

c) 9

d) 10

**Answer:** b) 8

9. The `Math.ceil()` method rounds a number:

a) Upward

b) Downward

c) To the nearest whole number

d) To the nearest even number

**Answer:** a) Upward

10. The keyword used to terminate a case in a `switch` statement is:

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

12. The logical NOT operator in Java is represented by:

a) !

b) ~

c) ^

d) ||

**Answer:** a) !

13. What is the result of `Math.abs(-15)`?


a) -15

b) 0

c) 15

d) -1

**Answer:** c) 15

14. The `Math.min(4, 10)` function returns:

a) 4

b) 10

c) 0

d) -6

**Answer:** a) 4

15. Which of the following is a conditional statement in Java?

a) for

b) if-else

c) while
d) do-while

**Answer:** b) if-else

16. The update expression in a `for` loop is executed:

a) Before the loop starts

b) After each iteration

c) At the end of the loop

d) Only when the loop terminates

**Answer:** b) After each iteration

17. Nested loops are used when:

a) Only one loop is required

b) One loop is placed inside another loop

c) A single condition needs to be checked

d) There is no fixed number of iterations

**Answer:** b) One loop is placed inside another loop

18. Ethical computing discourages:


a) Collaboration

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

d) All of the above

**Answer:** d) All of the above

22. The operator used for string concatenation in Java is:

a) +

b) =

c) &

d) ||

**Answer:** a) +

23. The result of `10 > 5 && 8 < 2` is:


a) true

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

26. The `Math.random()` method returns a value between:

a) 0.0 and 1.0

b) 0 and 100

c) 1 and 10

d) -1 and 1

**Answer:** a) 0.0 and 1.0

27. The keyword used to define a class in Java is:

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

29. The `Math.max(12, 25)` function returns:

a) 12

b) 25

c) 0

d) -13

**Answer:** b) 25

30. What will be the result of `System.out.println(10 % 3)`?

a) 1

b) 3

c) 10
d) 0

**Answer:** a) 1

31. Which of these is not a valid operator in Java?

a) +

b) **

c) /

d) %

**Answer:** b) **

32. To terminate a loop prematurely, the __________ statement is used.

a) continue

b) break

c) return

d) exit

**Answer:** b) break

33. The `Math.floor()` method rounds a decimal number:


a) Downward

b) Upward

c) To the nearest integer

d) To the nearest even number

**Answer:** a) Downward

34. What will be the result of `System.out.println(4 + 5 * 2)`?

a) 18

b) 14

c) 13

d) 9

**Answer:** b) 14

35. In Java, single-line comments are written using:

a) /* */

b) //

c) #
d) <!-- -->

**Answer:** b) //

36. What is the output of `Math.sqrt(16)`?

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()

38. The default value of a `boolean` variable in Java is:


a) 1

b) 0

c) true

d) false

**Answer:** d) false

39. The **ternary** operator in Java is represented by:

a) &&

b) ||

c) ?:

d) ==

**Answer:** c) ?:

40. What is the result of `System.out.println("Hello" + 10 + 20)`?

a) Hello30

b) Hello1020

c) 30Hello
d) Compilation error

**Answer:** b) Hello1020

41. Which of these is a valid declaration of a `float` variable in Java?

a) float f = 1.0;

b) float f = 1.0F;

c) float f = "1.0";

d) float f = '1.0';

**Answer:** b) float f = 1.0F;

42. The `switch` statement must contain a:

a) default case

b) break statement

c) case statement

d) condition in parentheses

**Answer:** d) condition in parentheses

43. The entry-controlled loops in Java are:


a) while and for

b) while and do-while

c) for and do-while

d) while and nested loops

**Answer:** a) while and for

44. The logical operator `&&` returns true if:

a) At least one condition is true

b) Both conditions are true

c) Both conditions are false

d) One condition is false

**Answer:** b) Both conditions are true

45. The keyword used to create an object in Java is:

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

47. To format output in Java, the __________ method is used.

a) printf()

b) format()

c) println()

d) print()

**Answer:** a) printf()

48. The `Math.log(1)` function returns:


a) 1

b) 0

c) Infinity

d) -1

**Answer:** b) 0

49. Which of these is not a valid data type in Java?

a) char

b) byte

c) short

d) real

**Answer:** d) real

50. Which method terminates the program in Java?

a) exit()

b) stop()

c) System.exit()
d) terminate()

**Answer:** c) System.exit()

You might also like