Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Fundamentals - 2

Total questions: 10

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following Statement is an example of Console Input Statement in JAVA

a)

System.in

b)

Scanner

c)

BufferedReader

d)

System.out

2.

Which of the following is a valid array initialization in java

a)

int a[]=new int[3]{1,2,3,4};

b)

int []a =new int[]{4,5,6};

c)

int a[3]={1,2,3};

d)

int a[]=new int[4]{1,2,3,4,5};

3.

Arrays class is belongs to the following package

a)

import java.util.*

b)

import java.lang.*;

c)

import java.io.*;

d)

import java.awt.*;

4.

By default random() method generates random numbers between

a)

1 to 10

b)

0.0 to 0.1

c)

0.0 to 1.0

d)

1 to 100

5.

Which of the following is/are valid console output statement(s) in java

a)

System.out.println("GEC");

b)

System.out.print("GEC");

c)

System.out.printf("GEC");

d)

System.out.printline("GEC");

6.

What is the output of the following Statement

int a= - 10

System.out.println(~a);

a)

11

b)

-5

c)

5

d)

9

7.

What is the output of the following Arithmetic Expression


39-28/3/3%3*21

a)

21

b)

11

c)

39

d)

6

8.

Which of the following is/are Invalid Underscore Literal(s)

a)

78_9_2

b)

34_.6_7

c)

89__3_

d)

2_________000

9.

Which of the following is/are valid character literal(s)

a)

'\a'

b)

's'

c)

'\u0061'

d)

'u21'

10.

Which of the following array declaration is invalid

a)

int a[]={4,5,6,7,87};

b)

int a[][]={new int[3],new int[4],new int[2]};

c)

int []a[]=new int[][]{{1,2,3,4},{1,2},{9}};

d)

int [][]a={{1,2},new int[3],{58,9,1,2}};

e)

None of these