Font size
WorksheetsMidterm Exam - CTCC0323
Total questions: 33
Worksheet time: 55mins
What is the full name of your instructor for CTCC0323?
(a)
A type of parameter which is defined in the method’s signature and used within the method.
formal parameter
actual parameter
signature parameter
real parameter
What is the purpose of the void keyword in declaring methods?
to not return any values
to return specific data types
to return specific values
to return all data types
The _____ keyword is a non-access modifier used for methods, which can help access methods without creating an object of a class.
static
void
public
console
Consider the following method signatures: void printMessage(String message) and void printMessage(int num). Can they properly function? Why?
Yes, they will properly work because of method overloading.
Yes, they will properly work because of method overriding.
No, because they have different parameters.
No, because they don’t have any code blocks.
Based on the given code snippet. The class Dog can make use of the method sleep from the class Cat. True or False?
True
False
Based on the given code snippet. Will the method work? Why or why not?
The method will work since it has a print function.
The method will work since it has no parameters.
The method will not work since it has a print function.
The method will not work since it has parameters.
An imported class which obtains input from the user.
Scanner
StringBuffer
String
StringBuilder
Which function is need to check if “Kyle Moreno” and “Kyle MOreno” is truly the same?
equals()
equalsIgnoreCase()
compareTo()
compareToIgnoreCase()
Which statement is TRUE about Strings in Java?
Strings are sequences of characters enclosed in double quotes.
Strings are mutable, which means once created it cannot be changed.
Strings need a null character to be terminated.
Strings need to be declared first.
To utilize the ArrayList in Java what should be the first thing to be done?
Import the ArrayList class from the utility library.
Create the ArrayList object.
Initialize values for the ArrayList object using the add method.
Change an item in the list using the set method.
A function which is used to traverse in an indexed structure such as an ArrayList.
for each loop
for loop
for which loop
while loop
Attributes and properties are the same thing. Yes, or no?
Yes, because they are both referring to variables.
Yes, because they alone characterize the object.
No, because you need behaviors for the object.
No, because attributes are built-in functions.
Analyze the given code snippet. Which of the given choices will complete the code?
String names : name
int name=0; name <= 3, ++names
int names=0; names >= 6, names++
String name : names
In declaring a file object in Java, it needs a file to read. True or False?
True
False
To remove an item from an ArrayList, use the removeItem() method.
True
False
Method is an instance of the class.
True
False
Coffee obKapengBarako = new Coffee();
Based on the statement. Which one is the object name?
obKapengBarako
KapengBarako
Coffee
Coffee()
LinkedList implements the same methods as the ArrayList. Yes, or no?
Yes, because they both implement the List interface.
Yes, because they’re under the Utility package.
No, because they don’t know each other.
No, because they do not have the same index values.
How to make this code work? Complete the code by choosing which option will make the greetUser method work.
System.out.println("Hello, " + name + "!");
return name;
System.out.print(name);
return System.out.println(“Hello, John!”);
A class is the blueprint for an object. What does the class define for the object to be used in its operations?
attributes and behaviors
attributes and properties
functions and behaviors
variables and methods
It is the values provided when a method is called.
(a)
Based on the given code snippet. What is the missing piece of code or syntax?
(a)
Based on the given code snippet. Which among the methods will function based on the input: Kyle Moreno?
(a)
Consider the following code snippet. Identify and correct the logical error in the code related to the calculation of the average.
(a)
Complete the code by typing the missing syntax or statement.
(a)
A String function that conducts a case-insensitive comparison which returns true if two strings are similar in content.
(a)
Based on the given code snippet. What will be the output of the code?
(a)
Based on the given code snippet. What will be the output of the code?
(a)
What would be the output of this code?
(a)
Based on the given code snippet. In complete syntax, change the last item to Josephine Bracken.
(a)
A programming paradigm which involves writing down a list of instructions to perform a task.
(a)
Cat obMuning = new Cat(); obMuning.ageOfCat;
Based on the code snippet. Which one is the variable?
(a)
