JAVA MODEL QUESTION PAPER
Part I: Multiple Choice Questions (20 Marks)
Each question carries 1 mark.
1. Which of the following is a valid wrapper class? a) int b) Byte c) float d) char
2. The default value of a boolean variable is: a) true b) false c) 0 d) null
3. Which operator is used for concatenation in Java? a) + b) & c) * d) .
4. What is the size of a double data type? a) 2 bytes b) 4 bytes c) 8 bytes d) 16 bytes
5. Which keyword makes a variable's value unchangeable? a) static b) final c) private d) public
6. [Link](4, 2) returns: a) 16 b) 16.0 c) 8.0 d) 8
7. The escape sequence for a new line is: a) \t b) \b c) \n d) \r
8. Which of these is a non-primitive data type? a) String b) long c) boolean d) double
9. The result of 5 + 3 * 2 is: a) 16 b) 11 c) 13 d) 10
10. Scanner class is present in which package? a) [Link] b) [Link] c) [Link] d) [Link]
11. An explicit type conversion is also called: a) Coercion b) Type Casting c) Promotion d) Buffering
12. Which operator is a Ternary operator? a) && b) ++ c) ?: d) !=
13. What is the result of 15 % 4? a) 3 b) 3.75 c) 1 d) 0
14. Which method is used to accept a word using Scanner? a) nextLine() b) nextWord() c) next() d)
input()
15. A set of characters enclosed in double quotes is called: a) Character literal b) String literal c)
Identifier d) Operator
16. Which of the following is a logical operator? a) == b) || c) += d) =
17. [Link]() does what? a) Prints and moves to next line b) Prints and stays on the same
line c) Clears the screen d) Accepts input
18. The extension of a Java source file is: a) .class b) .exe c) .java d) .obj
19. Who developed Java? a) James Gosling b) Dennis Ritchie c) Bjarne Stroustrup d) Bill Gates
20. [Link](-9) results in: a) -3.0 b) 3.0 c) NaN d) Error
Part II: Short Answer Questions (40 Marks)
Each question carries 2 marks.
1. Differentiate between [Link]() and [Link]().
2. What is a Token? Name any two types of tokens.
3. Rewrite the following using Ternary operator: if (a>b) max=a; else max=b;
4. Distinguish between / and % operators with an example.
5. What is the purpose of the new keyword?
6. Define 'Type Casting'.
7. Explain the use of [Link]() method.
8. What are the two types of Java programs? (Standalone and Applets).
9. Write the Java expression for: (a^2 + b^2) / (2ab).
10. What is a 'Literal'? Give one example of a floating-point literal.
11. Differentiate between if-else and switch statements.
12. What is the difference between = and ==?
13. Define an 'Identifier'. State one rule for naming it.
14. What is the difference between float and double?
15. Convert the following into Java: sqrt(b^2 - 4ac).
16. What is a 'Block' in Java?
17. Name two types of errors in Java.
18. What is the function of the [Link]() method?
19. Define 'Automatic Type Promotion'.
20. What is a Comment? Mention the syntax for a single-line comment.
Part III: Programming Section (40 Marks)
Answer any 4 out of 10. Each program carries 10 marks.
1. Area calculation: Write a program to calculate the area and perimeter of a rectangle. Accept
length and breadth from the user.
2. Temperature Converter: Write a program to convert temperature from Fahrenheit (F) to Celsius
(C) using the formula: C = (5/9) × (F - 32).
3. Interest Calculation: Write a program to calculate Simple Interest (SI = (P × R × T) / 100). Accept
P, R, and T as input.
4. Digit Extraction: Accept a 3-digit number and print the sum of its digits.
5. Average: Accept marks of 5 subjects for a student and calculate the average mark.
6. Swap: Write a program to swap two numbers using a third variable.
7. Math Methods: Accept a number and print its square root, cube root, and absolute value.
8. Discount: A shop offers a 10% discount on the total bill. Accept the bill amount and print the final
amount to be paid.
9. Triangle: Accept three angles of a triangle and check if it is valid (sum must be 180°).
10. Speed: Accept distance (in km) and time (in hours). Calculate and print speed in km/hr.