wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP (Object Oriented Programming)

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

Classes make objects. Which 2 objects were created in my program today?

a)

Abstract

b)

Leo

c)

Py

d)

Predator

2.

Classes make

a)

students

b)

objects

3.

Objects are created in a

a)

machine

b)

class

4.

Dog myers = new Dog();


The name of the class is:

a)

Dog

b)

myers

5.

Dog myers = new Dog();


The name of the object being made is:

a)

Dog

b)

myers

6.

Keeping attributes protected in a class

a)

abstraction

b)

inheritance

c)

encapsulation

d)

polymorphism

7.

Deciding what is most important about classes and requiring that. Choosing the methods that are required in all classes.

a)

abstraction

b)

inheritance

c)

encapsulation

d)

polymorphism

8.

When parent or superclasses give their attributes and methods to child or subclasses.

a)

abstraction

b)

inheritance

c)

encapsulation

d)

polymorphism

9.

The same method has different definitions in different classes. This means that the .speak() method will do something different when duck.speak() than dog.speak().

a)

abstraction

b)

inheritance

c)

encapsulation

d)

polymorphism

10.

The average base salary of a Java developer in the USA?

a)

$23,975

b)

$43,975

c)

$63,975

d)

$102,978

11.

Is Android based on Java?

a)

True

b)

False

12.

Which company owns Java?

a)

Oracle

b)

Microsoft

c)

Google

d)

Apple

e)

Intel

13.

Which level of a programming language is Machine Code?

a)

Low

b)

High

14.

Which type of loop iterates until condition become False?

a)

FOR loop

b)

A count-controlled loop

c)

Repeat-once loop

d)

WHILE loop

15.
for loop
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
16.
if - else statement
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
17.
single line comments, which the computer doesn't read, start with
a)
//
b)
..
c)
**
d)
uppercase letters
18.
Which of these is can be used for a switch statement that has a char argument:
a)
case 1:
b)
case one: 
c)
case "1":
d)
case '1':
19.
Which of these is can be used for a switch statement that has an int argument:
a)
case 1:
b)
case one: 
c)
case "1":
d)
case '1':
20.
Which of these is can be used for a switch statement that has a String argument:
a)
case 1:
b)
case one: 
c)
case "1":
d)
case '1':
21.
Which of these iterates (loops)
a)
if(...){
b)
char[] myArray = ...
c)
while(...){
d)
switch(...)
22.

block comments, which the computer doesn't read, and begin programs with infortion

a)

//

b)

..

c)

/**

*

**/

d)

uppercase letters

23.

comparing two ints

a)

==

b)

this.equals(that)

24.

All cases of a switch statement print if:

a)

you forget break statements

b)

you forget a closing curly bracket

c)

you forget a semicolon

d)

you forget a period

25.

This prints if none of the other cases in a switch statement print:

a)

case final:

b)

case default:

c)

default:

d)

error: case not found

26.

switch(thisWord){

a)

case "word":

b)

case word:

c)

case 'word':

27.

Which two are decision structures?

a)

if-else

b)

for loop

c)

switch

d)

while loop

28.

int a = 2, b = 3, c = 2;

if( a == b || a < c ){

System.out.println(“galaxy”);

}

else{

System.out.println(“comet”);

}

a)

galaxy

b)

comet

c)

nothing

29.

int grade = 98;

grade = grade/10;

switch(grade){

case 9:

System.out.println(“blue group”);

break;

case 8:

System.out.println(“green group”);

break;

default:

System.out.print(“purple group”);

}

What will print?

a)

blue group

b)

green group

c)

purple group

d)

nothing will print

30.

for(int i = 0; i < 4; i++){

System.out.print(i);

}


What will the printout be?

a)

01234

b)

0123

c)

1

2

3

4

d)

0

1

2

3

4

5