wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java for Geeks and Dummies

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.
How many percent of Fortune 500 companies use Java?
a)
50%
b)
40%
c)
80%
d)
90%
2.
What was the intended name of Java?
a)
Oak
b)
Pascal
c)
C
d)
C++
3.
Which of the following correctly initializes an array to contain four elements each with value 0?
I. int[ ] arr = { 0, 0, 0, 0};
II. int[ ] arr = new int[4];
III. int[ ] arr = new int[4];
     for(int i = 0; i < arr.length; i++)
       arr[i] = 0;
a)
I only
b)
I and II only
c)
I, II, and III
d)
I and III
4.
Create an array of 12 strings called months.
a)
String[] months = new String[12];
b)
String months = new String[12];
c)
String[] months = new String[];
d)
String[12] months = new String[];
5.
An object is an instance of a:
a)
parameter
b)
method
c)
class
d)
application
6.
Whats the output for the following:
String myCat = "Kizzy Cat";
String partOfmyCat = Mcat.substring(4)
System.out.Println(partofMyCat); 
a)
prints zzz Cat
b)
prints yCat
c)
Error " Exception in main thread"
d)
prints y Cat
7.
Whats the output for the following:
String myCat = "Kizzy Cat";
String partOfmyCat = Mcat.substring(4)
System.out.Println(partofMyCat); 
a)
prints zzz Cat
b)
prints yCat
c)
Error " Exception in main thread"
d)
prints y Cat
8.
These control the behavior of a program.
a)
class
b)
object
c)
method
d)
void
9.
This is the act of creating an object.
a)
overflow
b)
instantiation
c)
encapulsation
d)
objection
10.
String s1 = "Elephant";  
String s2 = "elephant";
String s3 = "aardvark"; 
//underscore represents space in output below

System.out.println(s1.charAt(3));
a)
h
b)
p
c)
a
d)
error message