Grade 9 ICSE – Java Application-Based Practice Sheet
Part A – Multiple Choice Questions (1 mark each)
1. Find the output.
char ch = 65;
[Link](ch + 1);
a) 66 b) B c) 65B d) AB
2. Which will correctly print Java\tRocks exactly as shown?
a) [Link]("Java\tRocks"); b) [Link]("Java\\tRocks");
c) [Link]('Java\tRocks'); d) [Link]("Java/tRocks");
3. What will happen?
final double PI = 3.14;
PI = 3.14159;
a) Changes value b) Runtime error c) Compile-time error d) Prints both values
4. Find the output.
[Link](5 + 5 + "5");
a) 55 b) 105 c) 155 d) Error
5. You want to store ASCII for 'M' in an int and print it. Which is correct?
a) int x = 'M'; [Link](x); b) int x = "M"; [Link](x); c) char x =
'M'; [Link]((int)M); d) int x = ASCII('M');
6. Debug:
char grade = "A";
a) No change b) Use single quotes c) Remove quotes d) Use int
7. Find the output.
char c = '\u0041';
c=c+1;
[Link](c);
a) A b) B c) C d) Error
8. Which will produce an error?
a) int x = 0x1A; b) int y = 010; c) int z = 08; d) double r = 2.5;
9. You want to print Hello\World. Which is correct?
a) [Link]("Hello\World"); b) [Link]("Hello\\World"); c)
[Link]('Hello\World'); d) [Link](Hello\\World);
10. Find the output.
int a = 5;
int b = a * 2;
[Link](b);
a) 5 b) 10 c) Error d) 0
11. Which initialization is dynamic?
a) int a = 10; b) int b = a * 5; c) final int x = 100; d) char c = 'C';
12. Find the output.
[Link]("Path: C:\\Java\\bin");
a) Path: C:\Java\bin b) Path: C:\Java\bin c) Path: C:Java\bin d) Error
13. You want to store Unicode Ω. Which is correct?
a) char omega = '\u03A9'; b) char omega = "u03A9"; c) char omega = '\u3A9'; d) char omega
= '\U03A9';
14. Find the output.
boolean flag = true;
[Link](!flag);
a) true b) false c) 0 d) 1
15. Debug:
int rate = 2.5f;
a) Use double b) Use float c) Use int with no decimal d) Use String
16. Find the output.
[Link]((char)90);
a) Y b) Z c) X d) [
17. Which will compile?
a) char c = 'AB'; b) char c = 'A'; c) char c = "A"; d) char c = 65.0;
18. Find the output.
[Link]("A\tB\tC");
a) A B C b) A B C c) A_B_C d) Error
19. Which will print ASCII of lowercase 'm'?
a) (int) 'm' b) 'm' c) ascii('m') d) (char) 'm'
20. Find the output.
[Link](2 + 2 + "2");
a) 222 b) 42 c) 22 d) 4
21. Debug:
String name = 'Java';
a) Use double quotes b) Use single quotes c) Use int d) Remove quotes
22. Find the output.
char ch = 97;
[Link](ch);
a) a b) 97 c) A d) Error
23. Which will cause compile-time error?
a) final int x = 5; x = 6; b) int y = 5; y = 6; c) int z; z = 10; d) double d = 3.5;
24. Find the output.
[Link]("Hello\nWorld");
a) Hello World b) Hello
World c) Hello\World d) Error
25. Debug:
int num = "100";
a) No change b) Remove quotes c) Use String instead of int d) Add semicolon
26. Find the output.
char c = 65;
[Link]((int)(c + 25));
a) 65 b) 90 c) 91 d) Z
27. Which literal is octal?
a) 0x1A b) 010 c) 26 d) 1A
28. Find the output.
char ch = '\u0043';
[Link](ch);
a) B b) C c) A d) D
29. Which line stores float correctly?
a) float x = 2.5; b) float x = 2.5f; c) float x = "2.5"; d) float x = '2.5';
30. Find the output.
[Link](010 + 1);
a) 11 b) 9 c) 8 d) Error
31. Debug:
boolean done = "false";
a) Use false without quotes b) Use String type c) Use int d) Remove variable
32. Find the output.
[Link]("He said, \"Java is fun!\"");
a) He said, Java is fun! b) He said, "Java is fun!" c) He said, "Java is fun!" d) Error
33. Which will store the largest decimal value?
a) float b) double c) int d) long
34. Find the output.
[Link](0x1A + 5);
a) 31 b) 26 c) 21 d) 1A5
35. Find the output.:
int val = '\u0041';
[Link](val);
a) 65 b) A c) Error d) 41
36. Find the output.
char c = 'C';
c += 3;
[Link](c);
a) E b) F c) D d) H
37. Which separator encloses class definitions?
a) () b) {} c) [] d) <>
38. Find the output.
[Link]("Java" + 10 + 5);
a) Java105 b) Java15 c) Java 15 d) 105Java
39. Which is valid Unicode format?
a) \u0041 b) \U0041 c) u0041 d) "u0041"
40. Find the output.
char c = 65;
[Link](++c);
a) A b) B c) C d) D
Part B – Two-Mark Questions
1. Guess the output:
char ch = 'a';
[Link]((int) ch + 5);
2. Debug this code:
final int SPEED = 60;
SPEED = 80;
3. Write one Java statement to print C:\Programs\Java.
4. Guess the output:
[Link]("Value:\n10");
5. Write code to store the Unicode value for the Greek letter π in a char variable and display it.
6. Debug this code:
boolean status = "true";
7. Guess the output:
[Link](010 + 5);
8. Write Java code to print the ASCII value of uppercase ‘G’.
9. Debug this code:
char c = 'AB';
10. Guess the output:
char ch = '\u0044';
[Link](++ch);
11. Write Java code that dynamically initializes an integer to twice the value of 15 and prints it.
12. Debug this code:
float rate = 5.5;
13. Guess the output:
[Link]("Java" + (5 + 5));
14. Write Java code to store the octal literal 010 in an integer and print its decimal value.
15. Debug this code:
String symbol = '\u0041';
16. Guess the output:
char c = 65;
c = c+5;
[Link](c);
17. Write Java code to declare a final variable for gravity (9.8) and display it.
18. Debug this code:
char letter = "Z";
19. Guess the output:
[Link](5 + "5" + 5);
20. Write Java code to print the Unicode smiley face ☺ using \u notation.