Which OOP concept bundles data and methods in a class while hiding internal details through private fields?
Correct answer C. Encapsulation
Topic / 35 questions
Java MCQs test your knowledge of the Java programming language, including the JVM, data types, operators, control statements, arrays and object-oriented ideas. They help computer science students and IT job applicants, and every question shows its correct answer instantly so you can check concepts as you practise.
Correct answer C. Encapsulation
Correct answer B. 16 bits
Correct answer C. final
Correct answer B. implements
Correct answer D. extends
Correct answer A. false
Correct answer D. 32 bits
Correct answer C. 532
Correct answer D. 2
Correct answer A. 55
Correct answer C. friendly
Correct answer A. Multiline comment
Correct answer D. Java Virtual Machine
Correct answer C. Equal
Correct answer C. go()
Correct answer A. Hierarchical inheritance
Correct answer C. Both A and B
Correct answer B. Switch
Correct answer C. Boolean
Correct answer D. <=' Operator
This topic covers core Java that interviewers and written tests often check. Questions ask which component provides the runtime environment for bytecode, which is the Java Virtual Machine, and which operator allocates memory to arrays, the new operator. You will also meet instance variables created with each object, jump statements such as break, continue and return, and exception handling with try, catch and finally. Operator precedence items, including how division and multiplication share equal precedence, also appear. These basics are useful for software house tests, computer lecturer posts and placement rounds.
Pakistan
India
Bangladesh
The JVM, or Java Virtual Machine, runs Java bytecode. The JRE, or Java Runtime Environment, contains the JVM plus the libraries needed to run Java programs. The JDK, or Java Development Kit, includes the JRE along with development tools such as the compiler javac, so it is needed to write and compile programs.
The new operator is used to allocate memory to an array in Java, for example int[] marks = new int[10];. It creates the array object on the heap and initialises numeric elements to zero. The same operator is used to create objects from classes.
Last reviewed October 2026