wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Midterm Exam - CTCC0323

Total questions: 33

Worksheet time: 55mins

Name
Class
Date
1.

What is the full name of your instructor for CTCC0323?

(a)  

2.

A type of parameter which is defined in the method’s signature and used within the method.

a)

formal parameter

b)

actual parameter

c)

signature parameter

d)

real parameter

3.

What is the purpose of the void keyword in declaring methods?

a)

to not return any values

b)

to return specific data types

c)

to return specific values

d)

to return all data types

4.

The _____ keyword is a non-access modifier used for methods, which can help access methods without creating an object of a class.

a)

static

b)

void

c)

public

d)

console

5.

Consider the following method signatures: void printMessage(String message) and void printMessage(int num). Can they properly function? Why?

a)

Yes, they will properly work because of method overloading.

b)

Yes, they will properly work because of method overriding.

c)

No, because they have different parameters.

d)

No, because they don’t have any code blocks.

6.

Based on the given code snippet. The class Dog can make use of the method sleep from the class Cat. True or False?

a)

True

b)

False

7.

Based on the given code snippet. Will the method work? Why or why not?

a)

The method will work since it has a print function.

b)

The method will work since it has no parameters.

c)

The method will not work since it has a print function.

d)

The method will not work since it has parameters.

8.

An imported class which obtains input from the user.

a)

Scanner

b)

StringBuffer

c)

String

d)

StringBuilder

9.

Which function is need to check if “Kyle Moreno” and “Kyle MOreno” is truly the same?

a)

equals()

b)

equalsIgnoreCase()

c)

compareTo()

d)

compareToIgnoreCase()

10.

Which statement is TRUE about Strings in Java?

a)

Strings are sequences of characters enclosed in double quotes.

b)

Strings are mutable, which means once created it cannot be changed.

c)

Strings need a null character to be terminated.

d)

Strings need to be declared first.

11.

To utilize the ArrayList in Java what should be the first thing to be done?

a)

Import the ArrayList class from the utility library.

b)

Create the ArrayList object.

c)

Initialize values for the ArrayList object using the add method.

d)

Change an item in the list using the set method.

12.

A function which is used to traverse in an indexed structure such as an ArrayList.

a)

for each loop

b)

for loop

c)

for which loop

d)

while loop

13.

Attributes and properties are the same thing. Yes, or no?

a)

Yes, because they are both referring to variables.

b)

Yes, because they alone characterize the object.

c)

No, because you need behaviors for the object.

d)

No, because attributes are built-in functions.

14.

Analyze the given code snippet. Which of the given choices will complete the code?

a)

String names : name

b)

int name=0; name <= 3, ++names

c)

int names=0; names >= 6, names++

d)

String name : names

15.

In declaring a file object in Java, it needs a file to read. True or False?

a)

True

b)

False

16.

To remove an item from an ArrayList, use the removeItem() method.

a)

True

b)

False

17.

Method is an instance of the class.

a)

True

b)

False

18.

Coffee obKapengBarako = new Coffee();

Based on the statement. Which one is the object name?

a)

obKapengBarako

b)

KapengBarako

c)

Coffee

d)

Coffee()

19.

LinkedList implements the same methods as the ArrayList. Yes, or no?

a)

Yes, because they both implement the List interface.

b)

Yes, because they’re under the Utility package.

c)

No, because they don’t know each other.

d)

No, because they do not have the same index values.

20.

How to make this code work? Complete the code by choosing which option will make the greetUser method work.

a)

System.out.println("Hello, " + name + "!");

b)

return name;

c)

System.out.print(name);

d)

return System.out.println(“Hello, John!”);

21.

A class is the blueprint for an object. What does the class define for the object to be used in its operations?

a)

attributes and behaviors

b)

attributes and properties

c)

functions and behaviors

d)

variables and methods

22.

It is the values provided when a method is called.

(a)  

23.

Based on the given code snippet. What is the missing piece of code or syntax?

(a)  

24.

Based on the given code snippet. Which among the methods will function based on the input: Kyle Moreno?

(a)  

25.

Consider the following code snippet. Identify and correct the logical error in the code related to the calculation of the average.

(a)  

26.

Complete the code by typing the missing syntax or statement.

(a)  

27.

A String function that conducts a case-insensitive comparison which returns true if two strings are similar in content.

(a)  

28.

Based on the given code snippet. What will be the output of the code?

(a)  

29.

Based on the given code snippet. What will be the output of the code?

(a)  

30.

What would be the output of this code?

(a)  

31.

Based on the given code snippet. In complete syntax, change the last item to Josephine Bracken.

(a)  

32.

A programming paradigm which involves writing down a list of instructions to perform a task.

(a)  

33.

Cat obMuning = new Cat(); obMuning.ageOfCat;

Based on the code snippet. Which one is the variable?

(a)