Data Structures 12th Edition by Y. Daniel
Liang | Comprehensive Complete Test
Bank | 2026/2027 Study Resource
Description: This revision set covers Java fundamentals, object-oriented
programming, data structures, algorithms, and advanced Java topics aligned with
the 12th Edition of Y. Daniel Liang's textbook. It is designed for exam preparation, self-
testing, and comprehensive revision for the 2026/2027 academic year.
Keywords: Java, Y. Daniel Liang, 12th Edition, Test Bank, MCQs, Revision, Data
Structures, OOP, Algorithms, 2026, 2027.
Chapter 1: Introduction to Computers, Programs, and Java
1. What is the correct extension of a Java source file?
A) .class
B) .java ✅
C) .exe
D) .jar
2. Which of the following is NOT a Java keyword?
A) class
B) public
,C) main ✅
D) static
3. What does JVM stand for?
A) Java Virtual Machine ✅
B) Java Variable Method
C) Java Visual Model
D) Just Virtual Machine
4. Which command compiles a Java program?
A) java
B) javac ✅
C) javadoc
D) jdb
5. What is the correct signature of the main method?
A) public void main(String args)
B) public static void main(String[] args) ✅
C) static void main(String args)
D) public main(String[] args)
Chapter 2: Elementary Programming
6. Which data type is used to store a single character?
A) String
B) char ✅
C) int
D) boolean
,7. What is the size of an int in Java?
A) 2 bytes
B) 4 bytes ✅
C) 8 bytes
D) Depends on OS
8. Which of the following is a valid identifier?
A) 1variable
B) _variable ✅
C) variable-1
D) class
9. What is the result of in Java (integer division)?
A) 2.5
B) 2 ✅
C) 3
D) 2.0
10. Which operator is used for modulus?
A) /
B) %
C) *
D) // ✅
Chapter 3: Selections
11. Which statement is used for decision making?
A) for
B) while
, C) if ✅
D) do-while
12. What is the output of: if (true) System.out.println("A"); else
System.out.println("B");
A) A ✅
B) B
C) AB
D) Compilation error
13. Which of these is a logical operator?
A) &
B) &&
C) |
D) ^ ✅
14. What does the ternary operator look like?
A) condition ? value1 : value2 ✅
B) condition : value1 ? value2
C) condition ? value1, value2
D) condition -> value1 : value2
15. Which switch statement is valid?
A) switch (x) { case 1: ... }
B) switch (x) { case "1": ... }
C) switch (x) { case 1.0: ... }
D) switch (x) { case true: ... } ✅
Chapter 4: Mathematical Functions, Characters, and Strings