Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Java(BlueJ)-Grade 8

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

Which of the following is a correct header line for main in a Java program?

a)

public static void main(args)

b)

public static void main(args [ ])

c)

public static void main(String args)

d)

public static void main(String args[ ])

2.

Which of the following is not the OOPS concept in Java?

a)

Inheritance

b)

Encapsulation

c)

Polymorphism

d)

Compilation

3.

7. State True or False: In Java single-line comments begins with ** and ends with //

a)

True

b)

False

4.

Which concept of Java is achieved by combining methods and attribute into a class?

a)

Encapsulation

b)

Inheritance

c)

Abstraction

d)

Polymorphism.

5.

3. A variable that holds a whole number

a)

String

b)

float

c)

int

d)

char

6.

What is the old name for Java Programming?

a)

Java

b)

Oak

c)

Java2

d)

C++

7.

State True or False:

Java is case sensitive?

a)

True

b)

False

8.

(a)   is known as the Father of the Java Language.

9.

What is the file extension for saving a Java file?

(a)  

10.

Which of the following is a data type that can store a number with a decimal point?

a)

int

b)

byte

c)

short

d)

double

11.

Which of the following best describes what a variable is in computer programming terms?

a)

the value of x

b)

A named location of the computer's memory that will store data

c)

the value of y

d)

Any data that a computer will need to store

12.

Java was developed in January _________ by a team of Sun Microsystems.

a)

1995

b)

1996

c)

1985

d)

1986

13.

Which of the below is an invalid identifier with the main method?

a)

private

b)

public

c)

static

d)

void

14.

Which of the following is incorrect?

a)

int count=50.25;

b)

float num=50.25;

c)

int x=50;

d)

all of these are correct

15.

When we want to print in Java, we use the code ......

a)

system.out.print();

b)

System.out.println();

c)

System.Out.Printf();

d)

System.out.show();

16.

How would you declare a variable storing a person's name?

a)

string name = "Tushar";

b)

string name =Tushar;

c)

String name = "Tushar";

d)

String name = Tushar;

17.

State True or False:

This is a correct initialization of a variable.


int myTemperature = 98.2;

a)

True

b)

False

18.

What is the output of the code below?

int x=5;

int y=2;

int z=x/y;

System.out.println(z);

(a)  

19.

The smallest meaningful element of Java is called a/an

a)

Identifier

b)

Token

c)

Variable

d)

Keyword

20.

State True or False:

While comparing two variables, their datatypes should be the same.

a)

True

b)

False