
CompProg2 Midterm Assessment
Quiz by Maria Lolita Masangcap
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
Using the String method char charAt(int index), what is returned when it is used?
The character in the given index
The characters of the string in its uppercase format
A substring starting to the character in the given index
True if it is a character and false if it is a string
60s - Q2
What will happen if when a method is called?
The program temporarily leaves the current method to execute the called method.
The called method will terminate and the program control will execute other methods in the program.
None of the Above
All of the Above
60s - Q3
Constructor creates an instance for the class.
Is the given statement TRUE? If yes, choose TRUE; otherwise, choose an answer that will replace the underlined word and will make the statement correct.
TRUE
object
method
variable
60s - Q4
Given the program code in the image, what type of method is it?
Method that accepts parameter/s and doesn’t return a value
Method that doesn’t accept a parameter and doesn’t return a value
Method that accepts parameter/s and returns a value
Method that doesn’t accept a parameter and returns a value
60s - Q5
Given the program code in the image, identify what is the constructor defined in it?
QuizMethods()
GetItem()
main()
GetAverage()
60s - Q6
Given the program code in the image, identify what are the parameter/s in the program fragment numbered 3?
x, y, z
double x, double y, double z
none
int h, int item
60s - Q7
Analyze the given the program code below, construct the main function by identifying its syntax and program statements that will give a similar output presented here.
None of the Above
60s - Q8
Kindly refer on the image for the string declarations. What will be the output of the statement below?
System.out.println(str3.charAt(10));
r
space
“ing Pro”
“ng Prog”
60s - Q9
Kindly refer on the image for the string declarations. What will be the output of the statement below?
System.out.println(str3.indexOf("Pro"));
9
10
8
7
60s - Q10
Kindly refer on the image for the string declarations. What will be the output of the statement below?
System.out.println(str3.substring(4, 11));
“ning Pr”
“ing Pro”
“rning P”
“ng Prog”
60s - Q11
Evaluate the following statements about methods:
1) It is not a reusable part of computer program.
2) It can produce answer value (return value).
3) It can take in special inputs (parameters).
4) Its idea is similar to functions in mathematics.
Which of the following is not true about methods?
Only Statement 1 is not true about methods.
Both statements 1 and 2 are not true about methods.
All the above statements are not true about methods.
Statements 1, 3, and 4 are not true about methods.
60s - Q12
Examine the following methods:
1) String toUpperCase()
2) int compareTo(String s)
3) String substring(int startIndex)
4) boolean equals (String s)
Which of the given method/s return/s string values?
Only Statement 1 and 3
All the given methods return string values.
Only Statement 2 and 4
Only Statement 3 and 4
60s - Q13
Evaluate the following statements about the ArrayList Class:
1) It is a resizable array.
2) It can be found in the java.util package.
3) It has a method remove() that is used to remove all elements in the array.
4) Elements declared of this class can be sorted in increasing order, alphabetically or numerically.
Which of the following is not true about ArrayList Class?
Only Statement 3 is not true about ArrayList Class.
All the above statements are not true about ArrayList Class.
Both statements 1 and 2 are not true about ArrayList Class.
Statements 1, 3, and 4 are not true about ArrayList Class.
60s - Q14
(1) ______________ itself does nothing but the real functionality is achieved through their (2) _______________.
(1) class, (2) objects
(1) Attribute, (2) Methods
(1) Object, (2) Classes
(1) Method, (2) Attribute
60s - Q15
Say that there are three classes: Employee, Non-Teaching, and Teaching. What are the likely relationships between these classes?
Employee is the parent class, Non-Teaching and Teaching are child classes of the Computer.
Teaching is the parent class. Employee and Non-Teaching are child classes of the Teaching class.
Employee is a parent class. Teaching is a child class of Employee, then Non-teaching is a child class of Teaching class.
None of the given options
60s