WorksheetsIntroduction to Java(BlueJ)-Grade 8
Total questions: 20
Worksheet time: 12mins
Which of the following is a correct header line for main in a Java program?
public static void main(args)
public static void main(args [ ])
public static void main(String args)
public static void main(String args[ ])
Which of the following is not the OOPS concept in Java?
Inheritance
Encapsulation
Polymorphism
Compilation
7. State True or False: In Java single-line comments begins with ** and ends with //
True
False
Which concept of Java is achieved by combining methods and attribute into a class?
Encapsulation
Inheritance
Abstraction
Polymorphism.
3. A variable that holds a whole number
String
float
int
char
What is the old name for Java Programming?
Java
Oak
Java2
C++
State True or False:
Java is case sensitive?
True
False
(a) is known as the Father of the Java Language.
What is the file extension for saving a Java file?
(a)
Which of the following is a data type that can store a number with a decimal point?
int
byte
short
double
Which of the following best describes what a variable is in computer programming terms?
the value of x
A named location of the computer's memory that will store data
the value of y
Any data that a computer will need to store
Java was developed in January _________ by a team of Sun Microsystems.
1995
1996
1985
1986
Which of the below is an invalid identifier with the main method?
private
public
static
void
Which of the following is incorrect?
int count=50.25;
float num=50.25;
int x=50;
all of these are correct
When we want to print in Java, we use the code ......
system.out.print();
System.out.println();
System.Out.Printf();
System.out.show();
How would you declare a variable storing a person's name?
string name = "Tushar";
string name =Tushar;
String name = "Tushar";
String name = Tushar;
State True or False:
This is a correct initialization of a variable.
int myTemperature = 98.2;
True
False
What is the output of the code below?
int x=5;
int y=2;
int z=x/y;
System.out.println(z);
(a)
The smallest meaningful element of Java is called a/an
Identifier
Token
Variable
Keyword
State True or False:
While comparing two variables, their datatypes should be the same.
True
False
