0% found this document useful (0 votes)
2 views5 pages

Java Basics MCQs

The document contains a series of multiple-choice questions (MCQs) related to Java programming, covering topics such as data types, loops, and keywords. Each question is followed by four options and the correct answer is provided. The questions assess basic knowledge of Java, including its object-oriented nature, data types, control structures, and class definitions.

Uploaded by

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

Java Basics MCQs

The document contains a series of multiple-choice questions (MCQs) related to Java programming, covering topics such as data types, loops, and keywords. Each question is followed by four options and the correct answer is provided. The questions assess basic knowledge of Java, including its object-oriented nature, data types, control structures, and class definitions.

Uploaded by

shraddha jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Basic MCQs (Loops, Datatypes, Static, If-Else)

1. Java is a ______ language.

 A. Low level
 B. Machine level
 C. Object Oriented
 D. Assembly

Answer: C

2. Java was developed by:

 A. Microsoft
 B. Sun Microsystems
 C. Oracle
 D. Google

Answer: B

3. Which is correct Java file extension?

 A. .class
 B. .java
 C. .exe
 D. .txt

Answer: B

4. Entry point of Java program is:

 A. start()
 B. init()
 C. main()
 D. run()

Answer: C

5. Size of int data type is:


 A. 2 bytes
 B. 4 bytes
 C. 8 bytes
 D. Depends

Answer: B

6. Which datatype stores true/false?

 A. int
 B. char
 C. boolean
 D. float

Answer: C

7. Which is not primitive datatype?

 A. int
 B. float
 C. String
 D. char

Answer: C

8. Which keyword makes variable constant?

 A. static
 B. final
 C. const
 D. private

Answer: B

9. Loop used when iterations are known:

 A. while
 B. do-while
 C. for
 D. foreach
Answer: C

10. Which loop executes at least once?

 A. for
 B. while
 C. do-while
 D. foreach

Answer: C

11. Condition in while loop is checked:

 A. After loop
 B. Before loop
 C. Never
 D. Runtime

Answer: B

12. if-else is used for:

 A. Looping
 B. Decision making
 C. Data storing
 D. Object creation

Answer: B

13. break statement is used to:

 A. Skip iteration
 B. Stop loop
 C. Restart loop
 D. Exit JVM

Answer: B

14. continue statement is used to:


 A. Stop program
 B. Skip iteration
 C. Exit loop
 D. Break loop

Answer: B

15. static keyword is used for:

 A. Memory sharing
 B. Object creation
 C. Method calling
 D. Looping

Answer: A

16. static members belong to:

 A. Object
 B. Class
 C. Method
 D. Constructor

Answer: B

17. Which loop is entry controlled?

 A. do-while
 B. while
 C. for
 D. Both B and C

Answer: D

18. Which loop is exit controlled?

 A. for
 B. while
 C. do-while
 D. foreach
Answer: C

19. Java supports:

 A. Multiple inheritance
 B. Single inheritance
 C. Hybrid inheritance
 D. All

Answer: B

20. Which keyword is used to define class?

 A. define
 B. class
 C. new
 D. object

Answer: B

You might also like