wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ICSE JAVA

Total questions: 61

Worksheet time: 31mins

Name
Class
Date
1.

Java was designed by _________________.

a)

Microsoft

b)

Mozilla Corporation

c)

Sun Microsystems

d)

Amazon Inc.

2.

Earlier name of Java Programming language was -

a)

Eclipse

b)

OAK

c)

Netbean

d)

C

3.

Which kind of language java is ?

a)

Object Oriented

b)

Procedural

c)

Event Driven

d)

None of these

4.

Which of the following are correct advantage of java?

a)

Java is Simple

b)

Java is Secure

c)

Java is Portable

d)

All of the above

5.

Default, public , protected, private are?

a)

Access Modifier

b)

Non-access Modifiers

c)

Both A and B

d)

It's variable

6.

Single line comment starts with _________ in Java.

a)

/**

b)

//

c)

/*

d)

None of these

7.

Java is case sensitive?

a)

True

b)

False

c)

Depends On Compiler

d)

May be true or false

8.

What is true in Java?

a)

For all class names the first letter should be in Upper Case

b)

All method names should start with a Lower Case letter.

c)

Name of the program file should exactly match the class name.

d)

All of the above

9.

All Java components require names. Names used for classes, variables, and methods are called?

a)

Variables

b)

identifiers

c)

Access Modifiers

d)

Java Modifiers

10.

Which of the following is smallest integer data type ?

a)

int

b)

byte

c)

short

d)

long

11.

Which of the following is not a primitive data type ?

a)

byte

b)

enum

c)

short

d)

int

12.

 Integer Data type does not include following primitive data type ____________.

a)

long

b)

byte

c)

short

d)

double

13.

Which of the following data types comes under floating data types ?

a)

int

b)

double

c)

long

d)

byte

14.

Character data type cannot store following value.

a)

Digit

b)

Letter

c)

Special Character

d)

String

15.

Range of Byte Data Type is ____________.

a)

-128 to 128

b)

-127 to 127

c)

-127 to 128

d)

-128 to 127

16.

What is size of integer in Java Programming.

a)

1 Byte

b)

2 Bytes

c)

4 Bytes

d)

8 Bytes

17.

Which of the following data type(s) can store 64 bit Value.

a)

boolean

b)

int

c)

float

d)

long

18.

Short data type has a minimum value of _____________.

a)

-32768

b)

-32767

c)

32768

d)

32767

19.

Default value of variable having boolean data type is ___________.

a)

true

b)

false

c)

null

d)

garbage

20.

What will be the output of the program?

class Main

{

void main()

{

int t;

System.out.println(t);

} }

a)

0

b)

garbage value

c)

compiler error

d)

runtime error

21.

What will be the output of the program?

class Test

{

void main()

{ for(int i = 0; 0; i++)

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

break; } } }

a)

Hello

b)

Empty Output

c)

Compiler error

d)

Runtime error

22.

What will be the output of the program?

a)

0

b)

1

c)

true

d)

false

23.

Predict the output of the following program.

a)

8

b)

8.0

c)

8.800000095

d)

8.0

24.

What is the output of this program?

a)

Infinity

b)

0

c)

NaN

d)

all of the mentioned

25.

What will be the output of the program?

a)

32

b)

36

c)

40

d)

48

26.

What will be the output of the program?

a)

48

b)

40

c)

56

d)

44

27.

n expression involving byte, int, and literal numbers is promoted to which of these?

a)

int

b)

byte

c)

long

d)

float

28.

Which data type value is returned by all transcendental math functions?

a)

int

b)

float

c)

double

d)

long

29.

Which one is a valid declaration of a boolean?

a)

boolean b1 = 1;

b)

boolean b2 = false;

c)

boolean b3 = false;

d)

boolean b4 = true

30.

Which of these can be returned by the operator &?

a)

Integer

b)

Boolean

c)

Character

d)

Integer or Boolean

31.

A ________ provides us with named storage that our programs can manipulate.

a)

data type

b)

constants

c)

operators

d)

variable

32.

 Each variable in Java has a specific type, which determines the size and layout of the variable's memory.

a)

TRUE

b)

FALSE

c)

Can be true or false

d)

Can not say

33.

To declare more than one variable of the specified type, we can use a comma-separated list.

a)

colon-separated

b)

bracket-separated

c)

comma-separated

d)

None of the above

34.

How many kinds of variables in Java?

a)

2

b)

3

c)

4

d)

5

35.

 Local variables are declared in?

a)

methods

b)

constructors

c)

blocks

d)

All of the above

36.

What is true about Instance Variables in java?

a)

Instance variables are declared in a class B

b)

When a space is allocated for an object in the heap, a slot for each instance variable value is created.

c)

Instance variables can be declared in class level before or after use

d)

All of the above

37.

Which variables have no default values?

a)

Static Variables

b)

Instance Variables

c)

Local Variable

d)

Both A and B

38.

Static variables can be accessed by calling with the?

a)

Object name

b)

Class name

c)

Function name

d)

Can not say

39.

Which of the following is an Example of variable initialization?

a)

int a, b, c;

b)

int a = 10, b = 10;

c)

int 10 = a;

d)

None of the above

40.

Access modifiers cannot be used for local variables.

a)

Yes

b)

No

c)

Can be yes or no

d)

Can not say

41.

Which of the following can be operands of arithmetic operators?

a)

Characters

b)

Boolean

c)

Numeric

d)

Both Numeric & Characters

42.

Modulus operator, %, can be applied to which of these?

a)

Both Integers and floating-point numbers

b)

Integers

c)

Floating-point numbers

d)

None of the mentioned

43.

Decrement operator,--, decreases the value of variable by what number?

a)

1

b)

2

c)

3

d)

4

44.

Which of these statements are incorrect?

A. B. As C. D.

a)

Assignment operators can be used only with numeric and character data type

b)

Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms

c)

Assignment operators run faster than their equivalent long forms

d)

None of the mentioned

45.

Can 8 byte long data type be automatically type cast to 4 byte float data type?

a)

TRUE

b)

FALSE

c)

Can be true or false

d)

can not say

46.

Evaluate the value of the expression?

6 - 2 + 10 % 4 + 7

a)

14

b)

12

c)

13

d)

10

47.

 What is/are highest order precedence operator(s) in Java?

a)

()

b)

{}

c)

Both A & B

d)

None of these

48.

The && and || operators

a)

Compare two boolean values

b)

Compare two numeric values

c)

Combine two boolean values

d)

Combine two numeric values

49.

Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?

a)

((x < 100) && (x > 1)) && (x < 0)

b)

((x < 100) && (x > 1)) || (x < 0)

c)

(1 > x > 100) || (x < 0)

d)

1 < x < 100 || x < 0

50.

Select from among the following character escape code which is not available in Java.

a)

\\

b)

\v

c)

\a

d)

\t

51.

Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?

a)

(int)Math.min(d);

b)

(int)Math.abs(d);

c)

(int)Math.max(d);

d)

(int)Math.floor(d);

52.

Predict the output of following Java Program?

a)

Compiler Error: Operator >> cannot be applied to negative numbers

b)

-2

2

c)

2

d)

2

2

53.

With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?

1. x++;

2. x = x + 1;

3. x += 1;

4. x =+ 1;

a)

1, 2 & 3

b)

1 & 4

c)

1, 2, 3 & 4

d)

3 & 2

54.

_________ are a sequence of characters.

a)

Character

b)

Strings

c)

Integer

d)

Classes

55.

In Java programming language, strings are treated as objects.

a)

TRUE

b)

FALSE

c)

Can be true or false

d)

Can not say

56.

The String class is?

a)

mutable

b)

immutable

c)

Both A and B

d)

None of the above

57.

Methods used to obtain information about an object are known as?

a)

string methods

b)

class methods

c)

object method

d)

accessor methods

58.

Which method returns the character at the specified index?

a)

int compareTo(Object o)

b)

int compareTo(String anotherString)

c)

char charAt(int index)

d)

int compareToIgnoreCase(String str)

59.

Which of these method of String class is used to obtain character at specified index?

a)

char()

b)

Charat()

c)

charat()

d)

charAt()

60.

A __________ statement allows us to execute a statement or group of statements multiple times.

a)

array

b)

loop

c)

function

d)

exception

61.

A __________ loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true.

a)

for

b)

do-while

c)

while

d)

None of the above