Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ICSE 9 Java computer applications final exam

Total questions: 113

Worksheet time: 4hrs 59mins

Name
Class
Date
1.

What is the main focus of Object Oriented Programming?

a)

Data-Oriented Programming

b)

Object-Oriented Programming

c)

Functional Programming

d)

Procedural Programming

2.

Which programming language is commonly used for Object Oriented Programming?

a)

JavaScript

b)

C++

c)

Java

d)

Python

3.

What are the building blocks of Object Oriented Programming?

a)

Arrays and Pointers

b)

Loops and Conditions

c)

Objects and Classes

d)

Functions and Variables

4.

Which of the following is a valid data type in Java?

a)

Boolean

b)

String

c)

All of the above

d)

Float

5.

What do operators in Java primarily do?

a)

Control Program Flow

b)

Perform Mathematical Operations

c)

Manipulate Objects

d)

Handle User Input

6.

What is the purpose of Input in Java?

a)

Display Output to the User

b)

Receive Data from the User

c)

Control Program Execution

d)

Perform Calculations

7.

Which category of methods does the Mathematical Library in Java contain?

a)

Mathematical Functions

b)

File Handling Methods

c)

String Manipulation Methods

d)

User Input Methods

8.

What are Conditional Statements used for in Java?

a)

Repeating Code Execution

b)

Handling Errors

c)

Making Decisions

d)

Sorting Data

9.

What is the purpose of Iterative Constructs in Java?

a)

Defining Classes and Objects

b)

Performing Repetitive Tasks

c)

Handling Exceptions

d)

Creating GUI Applications

10.

Which concept is introduced in the course 'Introduction to Java'?

a)

Data Structures

b)

Web Development

c)

Object-Oriented Programming

d)

Functional Programming

11.

What is the fundamental unit of Object-Oriented Programming?

a)

Function

b)

Variable

c)

Object

d)

Loop

12.

Which of the following is a valid value type in Java?

a)

Character

b)

Array

c)

Integer

d)

All of the above

13.

What do Operators in Java help achieve?

a)

Perform Operations on Data

b)

Code Reusability

c)

Efficient Memory Management

d)

Data Encapsulation

14.

What is the primary use of Conditional Statements in Java?

a)

Control Program Flow

b)

Perform Mathematical Operations

c)

Define Classes

d)

Handle User Input

15.

Which type of constructs are used for repetitive tasks in Java?

a)

Conditional Statements

b)

Iterative Constructs

c)

Exception Handling

d)

Object and Classes

16.

\n is used for ______

a)

New line feed

b)

Horizontal tab

c)

Vertical tab

d)

Backspace

17.

Java character set consists of

a)

Letters

b)

Digits

c)

Operators

d)

Delimiters

e)

All of the above

18.

Identify the conversion

a) int a=45;

long b = a;

a)

implicit

b)

explicit

c)

none of these

19.

Identify the Conversion


a) double d=23.67

int a= (int) d;

a)

implicit

b)

explicit

c)

none of these

20.

Which of the following is a conditional statement?

a)

if

b)

if else

c)

if else if

d)

all of the above

21.

Re-write above statement using ternary operator-

if(X<=Y)

X=Y;

else

Y=X;

a)

if(X<=Y) then X=Y else Y=X;

b)

if(X<=Y) ? X=Y : Y=X;

c)

(X<=Y) ? X=Y : Y=X;

22.

What will be the output of following statement-

System.out.println('A'=='a');

a)

true

b)

false

c)

A==a

d)

A=97

23.

What will be the output of following snippet-

a)

Both are not equal

b)

Both are equal

c)

Syntax error

d)

runtime error

24.

int marks = 80;

if( marks > 70 )

System.out.println("Distinction");

System.out.println("Congratulations");

else if( marks > 35 )

System.out.println("Pass");

a)

Distinction

Congratulations

b)

Pass

c)

Distinction

d)

Error ('else' without 'if')

25.

The if -else statement executes a block of code if a specified condition is

a)

true

b)

false

c)

both

d)

none

26.

What is the output of Java program with SWITCH?


int num=20;

switch(num)

{

case 10: System.out.println("TEN"); break;

case 20: System.out.println("TWENTY"); break;

case 30: System.out.println("THIRTY");

}

a)

TEN

b)

TWENTY

c)

THIRTY

d)

TEN TWENTY

27.

What is the output of the below Java program with a SWITCH statement?


int points=6;

switch(points)

{

case 6: ;

case 7: System.out.print("PASS");

case 8: ;

case 9: System.out.print(" Excellent");

case 10: System.out.print(" Outstanding"); break;

default: System.out.print("FAIL");

}

a)

PASS Excellent Outstanding

b)

Excellent

c)

Outstanding

d)

FAIL

28.

What are the keywords used to implement a SWITCH case in Java language?

a)

switch, case

b)

default

c)

break

d)

All of above

29.

Predict the output for the given program

a)

Case 2

b)

Case 3

c)

Default Case

d)

Case 2

Case 3

Default Case

30.

int marks = 50;

if( marks > 70 ){

System.out.println("Distinction");

}

else if( marks > 35 ){

System.out.println("Pass");

}

else{

System.out.println("Fail");

}

a)

Pass

b)

Distinction

c)

Fail

d)

Pass

Fail

31.

What is the output of Java program with SWITCH?


int num=20;

switch(num)

{

case 10: System.out.println("TEN"); break;

case 20: System.out.println("TWENTY"); break;

case 30: System.out.println("THIRTY");

}

a)

TEN

b)

TWENTY

c)

THIRTY

d)

TEN TWENTY

32.

Predict the output?


class jump_statments

{

public static void main(String args[])

{

int x = 2;

int y = 0;

for ( ; y < 10; ++y)

{

if (y % x == 0)

continue;

else if (y == 8)

break;

else

System.out.print(y + " ");

} } }

a)

1 3 5 7

b)

2 4 6 8

c)

1 3 5 7 9

d)

1 2 3 4 5 6 7 8 9

33.

Is "X" printed?

a)

YES

b)

NO

34.

Click ALL answers which result in an "X" printed.

a)

a = 3, b = 3, c = 3

b)

a = 5, b = 4, c = 7

c)

a = 1, b = 3, c = 5

d)

a = 6, b = 4, c = 3

e)

a = 5, b = 5, c = 3

35.

What is output?

a)

Jackson

b)

Memorial

c)

JacksonMemorial

d)

There is no ouptut

36.

What is output?

a)

-1

b)

0

c)

1

d)

2

37.

How many stars are printed?

a)

7

b)

3

c)

4

d)

5

e)

Infinite Loop

38.

In total, how many times is the inner loop executed?

a)

5

b)

10

c)

15

d)

50

e)

Infinite Loop

39.

What does the following code print?

a)

A rectangle of 9 rows with 5 stars per row

b)

A rectangle of 6 rows with 6 stars per row

c)

A rectangle of 7 rows with 5 stars per row

d)

A rectangle of 7 rows with 6 stars per row

e)

Infinite Loop

40.

What does the following code print?

a)

A rectangle of 8 rows with 5 stars per row

b)

A rectangle of 8 rows with 4 stars per row

c)

A rectangle of 6 rows with 5 stars per row

d)

A rectangle of 6 rows with 4 stars per row

e)

Infinite Looo

41.

How many times does the following method print a *?

a)

9

b)

6

c)

7

d)

10

42.
True/False
If a loop condition is never satisfied then the loop does not execute.
a)
True
b)
False
43.
a)

1 2 4 8 16 32 64

b)

1 2 4 8 16 32

c)

2 4 8 16 32 64

d)

2 4 8 16 32

e)

4 8 16 32 64

44.

2

a)

5

b)

7

c)

9

d)

13

e)

20

45.
a)

0.0

b)

-4.0

c)

5

d)

The program will end successfully, but nothing will be printed.

e)

Nothing will be printed. Run-time error: ArithmeticException.

46.

size of double data type is ______________

a)

8 bits

b)

32 bits

c)

16 bits

d)

64 bits

47.

How many stars are printed?

a)

7

b)

3

c)

4

d)

5

e)

Infinite Loop

48.

PREDICT THE OUTPUT:

int x = 60;

int y = 90;

if (y%x == 0 && y-x==30)

{

System.out.println("Hello World");

}

else

{

System.out.println("Error")

}

a)

Hello World

b)

Hello world

c)

Error

d)

Hello World

Error

49.

2

a)

5

b)

7

c)

9

d)

13

e)

20

50.
a)

-1 0 2 5

b)

-1 0 3 7

c)

-1 1 4 8

d)

0 2 5 9

e)

0 1 3 7

51.

Which is the alternative to SWITCH in Java language?

a)

break, continue

b)

for, while

c)

if-else

d)

goto, exit

52.

What is the output of Java program with SWITCH below?


int a=10;

switch(a)

{

case 10: System.out.println("TEN");

}

a)

No Output

b)

TEN

c)

Compiler error as there is no break

d)

None

53.

What is the output of Java program below?


int num=40;

switch(num)

{

case 5: System.out.println("FIVE"); break;

case 35+5: System.out.println("FORTY"); break;

case 20+30: System.out.println("FIFTY");

}

a)

FIVE

b)

FORTY

c)

FIFTY

d)

Error

54.

What is the output of the below Java program?


int persons = 45;

int random = 45;

switch(random)

{

case persons: System.out.print("CRICKET ");

default: System.out.println("RUGBY");

}

a)

CRICKET

b)

CRICKET RUGBY

c)

RUGBY

d)

Compiler error

55.

if a = 30, then value of b = a--+--a

a)

b= 56

b)

b= 58

c)

b= 57

d)

b= 59

56.

if p=10, then the output of the expression c= p++ *5 is

a)

50

b)

55

c)

45

d)

0

57.

The output of the following statements will be

int a = 14; b= 4;

boolean x=(a>b)? true:false

a)

true

b)

false

c)

error

d)

none of the above

58.

In this expression the ________ logical operator that will be performed first _

((a>b)&&(b>c))||(b>a)!(c>b))

a)

&&

b)

||

c)

!

d)

?

59.

Evaluate the following expression if the value of x=2, y=3 and z=1.

v = x + ––z + y++ +y

(a)  

60.

If int y = 10 then find int z = (++y * (y++ + 5))

(a)  

61.

What will be the output of the following code?

char x = ‘A’; int m;

m = (x == ‘a’) ? ‘A’ : ‘a’;

System.out.print(m);

(a)  

62.

Which of the following operators will give either a true or a false value as an output

a)

Relational

b)

Bitwise

c)

Logical

d)

Ternary

63.

What is the output of the following code


x=9

System.out.print(x++);

a)

9

b)

10

c)

11

d)

8

64.

int sum1 = 100 + 50;

int sum2 = sum1 + 250;

int sum3 = sum2 + sum2;

System.out.println(sum3);


What will be the final output?

a)

950

b)

800

c)

sum2sum2

d)

sum1250

65.

int x = 4;

System.out.println(x < 5 && x < 10);


What will be the output?

a)

false

b)

true

c)

4

d)

x < 5 && x < 10

66.

What is the output of below code?


int x = 5;

System.out.println(x++);

System.out.println(x);

a)

5

5

b)

6

6

c)

5

6

d)

6

5

67.

a=11,b=22

solve= a +b + a++ + b++ + ++a + ++b

a)

103

b)

164

c)

87

d)

94

68.
What is the output of the following code?
int x = 0;
while (x < 4) {
 x = x + 1;
}
System.out.println("x is " + x);
a)
0
b)
1
c)
3
d)
4
69.
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
 System.out.println("Welcome to Java");
 count++;
}
a)
8
b)
9
c)
10
d)
0
70.
How many times will the following code print "Welcome to Java"?
int count = 0;
do {
 System.out.println("Welcome to Java");
 count++;
} while (count < 10);
a)
0
b)
9
c)
8
d)
10
71.
The following loop displays _______________.
for (int i = 1; i <= 10; i++) {
 System.out.print(i + " ");
 i++;
}
a)
1 2 3 4 5 6 7 8 9
b)
1 2 3 4 5 6 7 8 9 10
c)
1 2 3 4 5 
d)
1 3 5 7 9
72.
What is the output for y?
int y = 0;
for (int i = 0; i<10; ++i) {
 y += i;
}
System.out.println(y);
a)
1
b)
36
c)
45
d)
9
73.
What is the number of iterations in the following loop:
 for (int i = 1; i < n; i++) {
 // iteration
 }
a)
2*n
b)
 n
c)
n - 1
d)
n + 1
74.

Which of the following includes the correct syntax for a for loop?

a)

for(int i = 0, i<10, i++)

b)

for(int i =0, run = 10)

c)

for(int i = 0; run = 10)

d)

for(int i = 0; i < 10; i++)

75.

What is ouptut by the code? Pretend it says System.out.println

a)

2

b)

3

c)

4

d)

5

e)

6

76.

What is the final value of x?

int x = 0;

for(int i = 1; i < 8; i += 3)

x += i;

a)

12

b)

22

c)

7

d)

0

e)

infinite loop

77.

What is the final value of x?

int x = 3;

while (x > 5)

x++;

a)

6

b)

5

c)

4

d)

3

e)

infinite loop

78.
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
 System.out.println("Welcome to Java");
 count++;
}
a)
8
b)
9
c)
10
d)
0
79.
What is the output of the following code?
int x = 0;
while (x < 4) {
 x = x + 1;
}
System.out.println("x is " + x);
a)
0
b)
1
c)
3
d)
4
80.
How many times will the following code print "Welcome to Java"?
int count = 0;
do {
 System.out.println("Welcome to Java");
 count++;
} while (count < 10);
a)
0
b)
9
c)
8
d)
10
81.
 Analyze the following code.
int count = 0;
while (count < 100) {
 // Point A
 System.out.println("Welcome to Java!");
 count++;
 // Point B
}
 // Point C
a)
count < 100 is always true at Point B 
b)
 count < 100 is always false at Point B
c)
 count < 100 is always true at Point A  and count < 100 is always false at Point C
d)
 count < 100 is always true at Point Coint C
82.
How many times is the println statement executed?
for (int i = 0; i < 10; i++) 
 for (int j = 0; j < 10; j++)
 System.out.println(i * j);
a)
100
b)
10
c)
45
d)
20
83.
What is the number of iterations in the following loop:
 for (int i = 1; i < n; i++) {
 // iteration
 }
a)
2*n
b)
 n
c)
n - 1
d)
n + 1
84.
What will be displayed when the following code is executed?
 int number = 6;
 while (number > 0) {
 number -= 3;
 System.out.print(number + " ");
 }
a)
6,3,0
b)
6,3
c)
3,0
d)
0
85.

Which is the alternative to SWITCH in Java language?

a)

break, continue

b)

for, while

c)

if-else

d)

goto, exit

86.

What is the output of the below Java program with a SWITCH statement?


int points=6;

switch(points)

{

case 6: ;

case 7: System.out.print("PASS");

case 8: ;

case 9: System.out.print(" Excellent");

case 10: System.out.print(" Outstanding"); break;

default: System.out.print("FAIL");

}

a)

PASS Excellent Outstanding

b)

Excellent

c)

Outstanding

d)

FAIL

87.

Complete the code below to create an object of Scanner class:

Scanner sc = new Scanner( (a)   );

88.

Name the package that contains Scanner class.

(a)  

89.

Name the type of error in case given below:

Missing semicolon.

a)

Syntax Error

b)

Logical Error

c)

Run-time error

90.

Name the keyword, to use the classes defined in a package.

(a)  

91.

Name the package that is invoked by default.

(a)  

92.

What is the method of initialization performed in the following statements?

double x=Math.sqrt(16);

System.out.println(x);

a)

Initialization during Declaration

b)

Call to a Method

c)

Referencing another Variable

d)

All of the above

93.

Predict the output of the following code if the values of

l and b are 6 and 5 respectively.


class rectangle_demo

{

static void areaPerimeter(int l,int b)

{

int a,p;

a=l*b;

p=2*(l+b);

System.out.println(a);

System.out.println(p);

}

}

a)

30 23

b)

29 30

c)

30 22

d)

27 22

94.

This function returns the maximum of 2 numbers

a)

Math.min()

b)

Math.max()

c)

Math.minmax()

95.

All mathematical functions are included in a class called

a)

Math

b)

System

c)

Scanner

96.

Math class is a part of Java.________ package

a)

io

b)

util

c)

lang

97.

what will be the output of Math.sqrt(-4.0)

a)

2

b)

-2

c)

NaN

98.

What will be the return value of Math.pow(2.0,3.0)

a)

8.0

b)

8

c)

NaN

99.

In the function Math.pow(a,b), b ( the index)can take a negative value

a)

True

b)

False

c)

NA

100.

The return value of Math.cbrt(-15.625) is

a)

2.5

b)

-2.5

c)

NaN

101.

__________ function returns the magnitude of the number without the sign

a)

Math.round

b)

Math.floor

c)

Math.abs

102.

The return data type for the Math.round() is________

a)

float

b)

integer

c)

double

103.

The return value for Math.round(-51.2) is

a)

-51

b)

-50

c)

-52

104.

Math.ceil() will always return _____ data type

a)

integer

b)

float

c)

double

105.

The output of the function Math.ceil(-31.987)

a)

-31

b)

-32

c)

-30

106.

The output of the function Math.ceil(-9.0)

a)

-9

b)

-8

c)

-10

107.

The output of Math.floor(36.987) is

a)

36

b)

37

c)

35

108.

The output of the function Math.floor(-0.9)

a)

1

b)

0

c)

-1

109.

This functions returns a random number between 0 and 1

a)

Math.round()

b)

Math.random()

c)

Math.intrandom()

110.

The methods which are created by system developers are called _________

a)

library method

b)

built-in method

c)

both

111.

Math.random()*n+1 generates number between

a)

1 and 0

b)

1 and n

c)

0 and n

112.

Math.random()*(n-m) +m generates a number between

a)

m and n

b)

n and m

c)

1 and m

113.

Math.max(-43,-41) will return

a)

-43

b)

-41

c)

NaN