0% found this document useful (0 votes)
1 views

Java Chapter1 MCQs Cleaned

The document contains a quiz with multiple-choice questions about Java programming, covering topics such as its creator, original name, components, syntax, data types, and control statements. Each question is followed by the correct answer. The quiz serves as a knowledge check for individuals familiar with Java.

Uploaded by

remadanabdi03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Java Chapter1 MCQs Cleaned

The document contains a quiz with multiple-choice questions about Java programming, covering topics such as its creator, original name, components, syntax, data types, and control statements. Each question is followed by the correct answer. The quiz serves as a knowledge check for individuals familiar with Java.

Uploaded by

remadanabdi03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1. Who is credited with creating Java?

A. Dennis Ritchie

B. Bjarne Stroustrup

C. James Gosling

D. Guido van Rossum

Answer: C

2. What was Java originally called?

A. Oak

B. Maple

C. Pine

D. Coffee

Answer: A

3. Which of the following is not part of Java technology?

A. Programming language

B. Deployment environment

C. Operating system

D. Development environment

Answer: C

4. What tool compiles Java source code into bytecode?

A. javadoc

B. java

C. javac

D. jvm

Answer: C

5. Which Java component interprets and executes bytecode?

A. JDK

B. JVM
C. JRE

D. IDE

Answer: B

6. What makes Java platform-independent?

A. JavaFX

B. JVM and Bytecode

C. JRE

D. JavaScript

Answer: B

7. What is garbage collection in Java?

A. Manual memory management

B. Automatically freeing unused memory

C. Removing unused variables

D. Optimizing for performance

Answer: B

8. How does Java ensure code security?

A. Using SSL

B. Class loader and bytecode verifier

C. JavaFX API

D. Firewall support

Answer: B

9. What is the correct syntax to declare the main method in Java?

A. public static void main()

B. static public void main(String[] args)

C. void main(String[] args)

D. public void Main(String args[])

Answer: B
10. What does System.out.println() do?

A. Reads input from the console

B. Creates an object

C. Prints text to the console

D. Loads a class

Answer: C

11. Which of the following is a valid variable name?

A. 8num

B. _name

C. &value

D. full name

Answer: B

12. How many primitive data types are there in Java?

A. 6

B. 7

C. 8

D. 10

Answer: C

13. What is a reference variable in Java?

A. Stores text only

B. Points to an objects address

C. Is a static variable

D. Cannot be reassigned

Answer: B

14. What will be the result of 5 / 2 in Java?

A. 2.5

B. 3
C. 2

D. Error

Answer: C

15. Which operator represents logical AND?

A. &

B. ||

C. &&

D. %

Answer: C

16. Which loop guarantees at least one execution?

A. for

B. while

C. do-while

D. switch

Answer: C

17. Which control statement is used to handle multiple fixed choices?

A. if

B. for

C. switch

D. continue

Answer: C

18. What is the index of the first element in an array?

A. -1

B. 0

C. 1

D. Depends on array type

Answer: B
19. Which method gives the size of an array in Java?

A. size()

B. getSize()

C. count()

D. length

Answer: D

20. What happens if you access an uninitialized object in an array?

A. Compilation error

B. Default value is used

C. NullPointerException

D. The value is skipped

Answer: C

You might also like