NEW
Font size
S
M
L
XL
WorksheetsKuis Dadakan ;)
Total questions: 15
Worksheet time: 15mins
Name
Class
Date
1.
System.out.println("Hello");
System.out.print("World);
how is the output of the code snippet above?
System.out.print("World);
how is the output of the code snippet above?
a)
Hello World
b)
"Hello World"
c)
Hello
World
World
d)
None of the above
2.
int x=3.5;
System.out.println(x);
how is the output of the code snippet above?
System.out.println(x);
how is the output of the code snippet above?
a)
4
b)
3
c)
Error
d)
3.5
3.
int j=7,k=5,m=8,result;
result=j/m*k;
System.out.println(result);
how is the output of the code snippet above?
result=j/m*k;
System.out.println(result);
how is the output of the code snippet above?
a)
0
b)
4.375
c)
0.175
d)
280
4.
You are writing a class and are using a global variable. Inside a method you declare a local variable with the same name as the global variable.
This programming style is poor because inside the method the global variable will have precedence over the local variable with the same name.
True or false?
This programming style is poor because inside the method the global variable will have precedence over the local variable with the same name.
True or false?
a)
True
b)
False
5.
What are Java’s primitive types?
a)
object, byte, string, char, float, int, long and short
b)
boolean, byte, string, thread, int, double, long and short
c)
boolean, thread, stringbuffer, char, int, float, long and short
d)
boolean, byte, char, double, float, int, long, and short
6.
Which of the following best describes a "Class"?
a)
an object
b)
a blueprint
c)
a collection of code
d)
all are correct
7.
What is a loop?
a)
A keyword used to skip over the remaining code.
b)
A set of logic that is repeatedly executed until a certain condition is met.
c)
A segment of code that may only ever be executed once per call of the program.
d)
None of the above.
8.
a)
[==]
[==][==]
[==][==][==]
[==][==][==][==]
b)
[==]
[==][==] [==][==][==]
[==][==][==][==]
c)
[==][==][==][==]
[==][==][==][==]
[==][==][==][==]
[==][==][==][==]
9.
int x = 3;
do{ System.out.println("Sukses");
x++; }
while(x==3);
how is the output of the code snippet above?
do{ System.out.println("Sukses");
x++; }
while(x==3);
how is the output of the code snippet above?
a)
Sukses
b)
no output
c)
Sukses
Sukses
Sukses
10.
int x=5;
if(x>4)
{ System.out.println("yoot"); }
else
{ System.out.println("yaat"); }
if(x==5)
{ System.out.println("horee"); }
if(x>4)
{ System.out.println("yoot"); }
else
{ System.out.println("yaat"); }
if(x==5)
{ System.out.println("horee"); }
a)
yoot
b)
yaat
c)
yoot
yaat
yaat
d)
yoot
horee
horee
11.
a)
Angka
b)
Empat
c)
Empat
Angka
Angka
d)
Tidak ada yang benar
12.
One advantage to using a WHILE loop over a FOR loop is that a WHILE loop always has a counter. True or false?
a)
True
b)
False
13.
Which of the following examples of Java code is not correct?
a)
int x=6;
b)
char c=’r’;
c)
boolean b=1;
d)
double d=4.5;
14.
The three logic operators in Java are:
a)
!=, =, ==
b)
&&, ||, !
c)
&&, !=, =
d)
&, |, =
15.
In Java what is casting?
a)
When you remove an object instance.
b)
When you reset an object instance.
c)
When you take an Object of one particular type and turn it into another Object type.
d)
Casting is not possible in Java.
Reset
