Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javapie Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the range of short data type in Java?

a)

-128 to 127

b)

-32768 to 32767

c)

-2147483648 to 2147483647

d)

None of the mentioned

2.

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

a)

int

b)

float

c)

double

d)

long

3.

Java is created by?

a)

Hal Abelson

b)

James Gosling

c)

Hannry Bottom

d)

Alfred Aho

4.

What will be the output of these statement?

class output {

public static void main(String args[])

{

double a, b,c;

a = 3.0/0;

b = 0/4.0;

c=0/0.0;

System.out.println(a);

System.out.println(b);

System.out.println(c);

}

}

a)

Infinity

b)

0.0

c)

NaN

d)

all of the mentioned

5.

Which of the following can be operands of arithmetic operators?

a)

Numeric

b)

Boolean

c)

Characters

d)

Both Numeric & Characters

6.

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

a)

Integers

b)

Floating – point numbers

c)

Both Integers and floating – point numbers

d)

None of the mentioned

7.

What is the output of this program?


class increment

{

public static void main(String args[])

{

double var1 = 1 + 5;

double var2 = var1 / 4;

int var3 = 1 + 5;

int var4 = var3 / 4;

System.out.print(var2 + " " + var4);

}

}

a)

1 1

b)

0 1

c)

1.5 1

d)

1.5 1.0

8.

What is the output of this program?


advertisement

class Modulus

{

public static void main(String args[])

{

double a = 25.64;

int b = 25;

a = a % 10;

b = b % 10;

System.out.println(a + " " + b);

}

}

a)

5.640000000000001 5

b)

5.640000000000001 5.0

c)

5 5

d)

5 5.640000000000001

9.

Which of these are selection statements in Java?

a)

if()

b)

for()

c)

continue

d)

break

10.

Which of the following is not OOPS concept in Java?

a)

Inheritance

b)

Encapsulation

c)

Polymorphism

d)

Compilation

11.

Which of these is an incorrect array declaration?

a)

int arr[] = new int[5].

b)

int [] arr = new int[5].

c)

int arr[] = new int[5].

d)

int arr[] = int [5] new

12.

What is the output of this program?


class array_output

{

public static void main(String args[])

{

int array_variable [] = new int[10];

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

{

array_variable[i] = i;

System.out.print(array_variable[i] + " ");

i++;

}

}

}

a)

0 2 4 6 8

b)

1 3 5 7 9

c)

0 1 2 3 4 5 6 7 8 9

d)

1 2 3 4 5 6 7 8 9 10

13.

Which of these is necessary to specify at time of 2D array initialization?

a)

Row

b)

Column

c)

Both Row and Column

d)

None of the mentioned

14.

What is the output of following program ?


public class Solution {

public static void main (String[] args) {

String s="563";

System.out.println(12 + s + 70);

}

}

a)

12s70

b)

1256370

c)

645

d)

12633

15.

What is mean by JVM ?

a)

Java Virtual Maintenance

b)

Java Verification Machine

c)

Java Virtual Machine

d)

Jason Virtual Machine

16.

Which of these can not be used for a variable name in Java?

a)

identifier

b)

keyword

c)

identifier & keyword

d)

none of the mentioned

17.

The while loop repeats a set of code while the condition is not met?

a)

True

b)

False

18.

Which of these is an incorrect Statement?

a)

It is necessary to use new operator to initialize an array

b)

Array can be initialized using comma separated expressions surrounded by curly braces

c)

Array can be initialized when they are declared

d)

None of the mentioned

19.

Which of these coding types is used for data type characters in Java?

a)

ASCII

b)

ISO-LATIN-1

c)

UNICODE

d)

None of the mentioned

20.

What is the output of this program?


class mainclass {

public static void main(String args[])

{

char a = 'A';

a++;

System.out.print((int)a);

}

}

a)

66

b)

67

c)

65

d)

64