Font size
WorksheetsJava
Total questions: 69
Worksheet time: 35mins
Java was originally named:
Coffee
Oak
New C++
Duke
From where did Java get its name?
Coffee
Book
TV Programme
Initials of the developers of Java
Is Android based on Java?
True
False
When was Java released?
1975
1985
1995
2005
2015
Who invented Java?
James Gosling
Sergey Brin
Steve Jobs
Bill Gates
Tim Berners-Lee
What is the name of the Java mascot?
Duke
Ronny
Penguin
James
Jack
How many Java developers are there?
1 million
5 million
10 million
20 million
What was Java originally designed for?
Interactive TV
Internet
Gaming
Cars
Which company owns Java?
Oracle
Microsoft
Apple
Intel
which of the following is wrapper class in java
Float
Integer
Double
all of above
which one this keywords are used to create a class in java
class
struct
int
none of the avove
which one of these events will cause the thread to die?
on calling the sleep() method.
when the execution of the run() method ends
when the execution of the start() method ends
on calling the wait() method
_________ operator returns the remainder after division
+
/
%
*
________ operator is used to check the equality of two values
>=
=
*=
==
Bit wise operations only carried out only in integer /long integer values.
True
False
Operator used to access the members of a class /package
(.) Dot
(,) Comma
Java has goto statement
True
False
Java doesn't support structures and unions
True
False
Java is
platform dependent
platform indeprndent
In Java WORA stands for
Write Once Recall Anywhere
Write Once Return Anywhere
Write Once Read Anywhere
Write Once Run Anywhere
JVM stands for
Java Vital Machine
Java Virtual Machine
Java Vendor machine
Java programs ________________
are only compiled
are only compiled not interpreted
are only interpreted
are both compiled and interpreted
In Java, execution starts from ___________ function.
get()
main()
java()
display()
Main() method is not mandatory for a Java program
True
False
++ increases the value of a variable by 1
assignment operator
decrement operator
increment operator
sentinel
What would the new value of A be?
A=1;
a++;
1
2
3
4
What's the value of below?
int i=5;
System.out.println(i++);
System.out.println(i);
System.out.println(++i);
5
6
7
6
6
7
6
7
8
5
5
6
Which statement(s) are equivalent to i = i + 1?
i += 1
i++
i -= 1
i--
Which are the types of operators seen? Select as many you think
bitwise operator
subtraction operator
equality operator
arithmetic operator
what is modulo operation used for ?
performs division
performs division and gives no remainder
performs division and gives remainder
does not perform division
arithmetic operators return a value. True or false?
true
false
conditional operators does not return a value
true
false
which data types work on bitwise operators?
byte
double
char
int
which type of operator it is? i + =5
addition assignment operator
conditional operator
arithmetic operator
equality operator
Find the output for the following.
public class IncDec
{
public static void main(String s[])
{
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
System.out.println("a = " + a);
System.out.print("b = " + b);
System.out.println("c = " + c);
System.out.print("d = " + d);
}
}
a = 2 b = 3 c = 4 d = 1
a = 2 b = 3 c = 4 d = 1
Program does not compile.
a = 1 b = 2 c = 4 d = 2
What will be the output of the program?
class Test
{
public static void main(String [] args)
{
int x=20;
String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
System.out.println(sup);
}
}
small
tiny
huge
Compilation fails
Find the output of the following snippet.
class Numbers
{
public static void main(String args[])
{
int a=20, b=10;
if((a<b)&&(b++ <25))
{
System.out.println("this is any language logic");
}
System.out.println(b);
}
}
10
12
11
Compilation Error
Please write correct output in following space-
10
20
No Output
Error
A variable that holds words
String
boolean
int
float
A dictionary
A variable that holds true or false
String
boolean
int
float
Alex Trebek
Name the data type: 1.0
double
int
char
boolean
Name the data type: "true"
boolean
char
String
double
Name the data type: false
String
boolean
int
None of the above
What data type would you use for storing the number of students in a class?
boolean
String
double
int
What data type would you use for storing the average test score in a class?
double
String
int
char
What data type would you use to store names of students?
String
char
boolean
None of these
blonde
How would you declare a variable storing the tax rate?
int taxRate = 5.1;
taxRate = "5.1";
double taxRate = 5.1;
double taxRate = "5.1";
I do hereby declare thee Sir Tax Rate
How would you declare a variable storing a person's name?
string name = "Elroy";
name String = "Elroy";
String name = Elroy;
String name = "Elroy";
Me llamo Elroy
How would you declare a variable that tells you that someone passed a class?
boolean passed = 'true';
boolean passed = true;
passed = true;
String passed = "true";
Trick question - no one passes this class
Which declaration will throw an error?
double num = 8;
int averageGrade = 89.7;
boolean done = false;
String done = "true";
What prints out "I love Java" successfully?
System.out.println(I love Java);
Systemoutprintln("I love Java);
System.out.println("I love" + " Java");
System.out.println("I love Java")
What is love? Baby dont hurt me. Dont hurt me. No more.
Describe method.
A component of a program in a big program.
A program to perform a specific task.
A component of a program written to perform a specific task.
A variable that use to read an input.
This is an example of a non-return method.
True
False
Method make codes more readable and easier to debug.
True
False
The name of this method is ....
Oddsum
int Oddsum
int Oddsum (int number)
return totaloddsum
The different between static and non static method is ....
for non static method : user need to create object in a class to call a method.
A method is to perform only specific task.
There is no significant differences between static and non - static method.
Both are bounded with a class.
Data type for non return method is
int
double
void
public static
Which one of the following is escape sequences?
\r
\n
\f
\t
Int data types represents _______ bits.
8
16
32
64
Enter your Reg No
