
CompProg2 CP1 Assessment
QuizĀ by Maria Lolita Masangcap
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
public class MyFirstJavaProg{
}
With this given declaration of class, the file name of this java program must beĀ MyFirstJavaProgram.java.
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.
A type of method in Java that written by programmers for a specific purpose
When a method is called, the program temporarily leaves the (1) ____________ to execute the (2) _______________.
Which of the following is not a valid variable type in Java?
Given the sample method, what is the method type?

Given the sample method, what is the method name?

Given the sample method, what is/are the parameter/s?

Given the sample method, what is/are the local variable/s declared?

Given the sample method, what is the value to be returned?

Method that invokes and controls the execution of other functions within its scope.
What type of method is given in the image?

Method that is used to write or change the value of members fields
Allows a programmer to define several different versions of a method, all with the same name but each with a different argument or parameter list
Variables that are declared and initialized within the method, constructor or block and these variables are destroyed when the method or constructor have completed.
When you a write a program in Java, you create a ________________.
Variables declared within a class, outside any method, with the static keyword
Which of the following is not true about methods?
The number and type of arguments passed by theĀ _________________Ā must agree with the number and type of the parameters in the _________________.
A string method that returns a String that starts at the startIndex and ends at the character before afterEndingIndex
Returns the integer representing the position number where the s starts in the String. If it isn't in the String, indexOf returns ā1.
A string method that returns the integer based on the result of the comparison
What will be the output of the statement below?
System.out.println(text1.charAt(7));

What will be the output of the statement below?
System.out.println(text1.substring(2,13));

What will be the output of the statement below?
System.out.println(text2.substring(13));

What will be the output of the statement below?
System.out.println(text2.length());

What will be the output of the statement below?
System.out.println(text1.indexOf("mmanuel"));

What will be the output of the statement below?
System.out.println(text2.indexOf("sangcap"));

What will be the output of the statement below?
text3 = text2.substring(6,14) +" Garcia "+text1.substring(14,20);
System.out.println(text3.toUpperCase());

What will be the output of the statement below?
What will be the output of the statements shown inĀ the image?
What will be the output of the statement below?
text3 = text2.substring(6,14) +" Garcia "+text1.substring(14,20);
System.out.println(text3.length());

What will be the output of the statements shown in the image?

Sequence of characters or group of text
What will be the output of the statement below?
text4 = text2.substring(0,7) + text1.substring(0,9);
System.out.println(text4.toLowerCase());

Given the code, what is the name of the array declared?

A class in Java that is used to create array that is resizable and can be modified whenever you want.
Given the code, what is the size of the declared array?

When the code is run, what is the 4th element that will be displayed?

Given the code, what is the pre-defined method used to display the elements of the array?

Given the code, what will be its output once it is run?

Which of the following methods for ArrayLIst class is used to modify the value of an element using the index?