You are on page 1of 86

Question 1

Complete
Mark 1.00 out of 1.00

Question text
Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE.
Given that:
int x = -77; The last line of code, with a close brace { symbol, is properly
indented.
int z = 43;
indented.
result = (z != 43) ? true : false;
Select one:
Select one:
True
True
False
False
Question 3
Question 2 Complete
Complete Mark 1.00 out of 1.00
Mark 1.00 out of 1.00
Question text
Question text
True or False: Brackets [] are also separators used in declaring
Read each statement carefully and decide whether it’s TRUE arrays.
or FALSE.
Answer:
True

Question 4
Complete
Mark 1.00 out of 1.00

Question text
Refer to the block of codes below. Read each statement
carefully and decide whether it’s TRUE or FALSE.
There is an error in line 9.
Answer:
TRUE
There are no errors in the program.
Question 5 Select one:
Complete
Mark 1.00 out of 1.00
False

Question text Question 7


Complete
True or False: Operators, in Java programming language, use Mark 0.00 out of 1.00
special symbols to call methods and their objects.
Question text
Answer:
Refer to the block of codes below. Read each statement
False
carefully and decide whether it’s TRUE or FALSE.
Question 6
Complete
Mark 0.00 out of 1.00

Question text
Read each statement carefully and decide whether it’s TRUE
or FALSE.

Line 9 uses a traditional comment which uses double forward


slash.
Answer: FALSE result = (x = 100) >= z;

Question 8 Select one:


Complete True
Mark 1.00 out of 1.00
False
Question text
True or False: Many programmers can be literate with Java
programming language for it is intended to be that way.
Answer:
True

Question 9
Complete
Mark 1.00 out of 1.00

Question text
True or False: You’ll know there’s an error if you see a red
circle with an exclamation point in Netbeans IDE.
Answer:
True

Question 10
Complete
Mark 1.00 out of 1.00

Question text
Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE.
Given that:
int x = -77;
int z = 43;
Question 1 If there are no errors and this simple program runs through CLI,
Complete the first line will display: Hi, students!
Mark 1.00 out of 1.00
Select one:
Question text
False
Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE. Question 3
Complete
Given that: Mark 1.00 out of 1.00

int x = -77; Question text


int z = 43; Refer to the block of codes below. Read each statement carefully
result = (x * z + (z += 7)) >= 100; and decide whether it’s TRUE or FALSE.

Select one:
If there are no errors in the program, the first line of output would
True read Hi, I’m a normal person.
False Answer:
FALSE
Question 2
Complete
Mark 0.00 out of 1.00 Question 4
Complete
Question text Mark 1.00 out of 1.00

Read each statement carefully and decide whether it’s


TRUE or FALSE.

Flag question

Question text
Refer to the block of codes below. Read each statement carefully
and decide whether it’s TRUE or FALSE.

When the program runs, and assuming there are no errors, its
first line will be begin printing.
Answer: Complete
Mark 1.00 out of 1.00
FALSE
Question text
Question 6
Complete
True or False: When you run javac in a command line interface, it
Mark 1.00 out of 1.00 will automatically create another file with a filename extension
.class.
Question text
Answer:
True or False: The conditional AND operator uses two True
ampersand (&&) symbols.
Answer:
True

Question 8
Complete
Mark 1.00 out of 1.00

Question text
True or False: A boolean variable can only have two values; it is
either true or false.
Answer:
True

Question 9
Complete
Mark 0.00 out of 1.00

Question text
Refer to the block of codes below. Read each statement carefully
and decide whether it’s TRUE or FALSE.

There are keywords found in line 7.


Answer: true

Question 10
Question 1 On line 6, average is equal to 0. But on line 9, average will be
Complete equal to 100.
Mark 1.00 out of 1.00
Select one:
Question text
True
Refer to the block of codes below. Read each statement carefully False
and decide whether it’s TRUE or FALSE.
Question 4
Complete
If there are no errors in the program, line 9 would display I weigh Mark 1.00 out of 1.00
160.
Question text
Answer:
FALSE Refer to the program below. Read each statement carefully and
write the output for each line specified.
Question 2
Complete 18
Mark 1.00 out of 1.00 Line 13 will display Answer on the screen.
Question text Question 5
Complete
True or False: The subtraction assignment operator subtracts the Mark 1.00 out of 1.00
left and right operand and assigns the difference to the operand
at the right.
Question text
Answer:
False Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE.
Question 3 Given that:
Complete
Mark 1.00 out of 1.00 int x = -77;

Question text int z = 43;


result = 43 <= z;
Read each statement carefully and decide whether it’s
TRUE or FALSE.
Select one:
True
False
Question 6
Complete
Mark 1.00 out of 1.00
The file is accurately named – Students.java.
Question text
Refer to the block of codes below. Read each statement carefully Select one:
and decide whether it’s TRUE or FALSE.
False
The last line of code will output 100.0. Question 9
Complete
Answer: Mark 1.00 out of 1.00
TRUE
Question text
Question 7 True or False: Java is a low level programming language.
Complete
Mark 1.00 out of 1.00 Answer:
False

Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question text
True or False: Traditional comments start with /** (forward slash
True or False: Single equal sign (=) is used for assigning values and two asterisks) and ends with */ (asterisk and forward slash).
while double equal sign (==) is used in comparing values.
Answer:
Answer: False
True

Question 8
Complete
Mark 0.00 out of 1.00

Question text

Read each statement carefully and decide whether it’s


TRUE or FALSE.
Question 1 There are three (3) separators found in line 13.
Complete
Mark 1.00 out of 1.00 Answer:
False
Question text
True or False: An exclamation point in Java means NOT. Question 4
Therefore, != means not equal to. Complete
Mark 1.00 out of 1.00
Answer:
Question text
True
True or False: Syntax is basically the spelling and grammar errors
Question 2 compiled in a Java programming language. It should be avoided
Complete in writing apps and applets.
Mark 1.00 out of 1.00
Answer:
Question text False

Observe the following statements and decide whether the


variable result’s value is TRUE or FALSE. Question 5
Complete
Given that: Mark 1.00 out of 1.00
int x = -77; Question text
int z = 43; Refer to the block of codes below. Read each statement carefully
result = (z != 43) ? true : false; and decide whether it’s TRUE or FALSE.

Select one:
True
False

Question 3
Complete
Mark 1.00 out of 1.00

Question text
There are five (5) separators used in line 8.
Refer to the block of codes below. Read each statement carefully
and decide whether it’s TRUE or FALSE. Answer:
True
Question 6
Complete
Mark 1.00 out of 1.00

Question text
True or False: The subtraction assignment operator subtracts the
left and right operand and assigns the difference to the operand
at the right.
Answer:
False Select one:
True
Question 7
Complete False
Mark 1.00 out of 1.00
Question 9
Question text Complete
Mark 1.00 out of 1.00
True or False: Single equal sign (=) is used for assigning values
while double equal sign (==) is used in comparing values. Question text
Answer: Observe the following statements and decide whether the
True variable result’s value is TRUE or FALSE.
Given that:
Question 8
Complete int x = -77;
Mark 1.00 out of 1.00
int z = 43;
Question text
result = (z < x && 1 != 10) ? true : false;
Read each statement carefully and decide whether it’s
result = (x = 100) >= z;
TRUE or FALSE.
There are no errors in the program. Select one:
True
False

Question 10
Complete
Mark 1.00 out of 1.00
Flag question

Question text
True or False: JDK or Java Design Kit is required to compile and
run Java apps and applets.
Answer:
True
Mark 1.00 out of 1.00
Question 1
Complete Question text
Mark 1.00 out of 1.00

Question text Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE.
Refer to the block of codes below. Read each statement carefully
Given that:
and decide whether it’s TRUE or FALSE.
int x = -77;
There are keywords found in line 7. int z = 43;
Answer: result = (x * z + (z += 7)) >= 100;
true
Select one:
True
Question 2
Complete False
Mark 1.00 out of 1.00
Question 5
Question text
Complete
Refer to the block of codes below. Read each statement carefully Mark 1.00 out of 1.00
and decide whether it’s TRUE or FALSE. Question text
True or False: There are five types of integer data types – byte,
There is an error in line 9. short, int, long and float.
Answer: Answer:
true
false

Question 3
Question 7
Complete
Complete
Mark 0.00 out of 1.00
Mark 1.00 out of 1.00
Question text Question text
True or False: Java’s ternary operator is a short hand for the if- True or False: A boolean variable can only have two values; it is
then-else statement which uses a question mark and a colon. either true or false.
Answer: True Answer:
true
Question 4
Complete
Question 8 int z = 43;
Question 9 result = 90 < x || -1 < z;
Complete
Mark 1.00 out of 1.00 Select one:
Question text True
False
True or False: You’ll know there’s an error if you see a red circle
with an exclamation point in Netbeans IDE.
Answer: True or False: The modulus operator returns the remainder of a
division operation instead of the quotient.
true
Answer:
Question 10 true
Complete
Mark 1.00 out of 1.00 True or False: Identifiers in Java are, in simple words, name that
you give to Java class, variables and methods.
Question text
Answer:
Refer to the block of codes below. Read each statement carefully
true
and decide whether it’s TRUE or

Line 14 will yield an error. It will be corrected if you place */ after


the method.
Answer: FALSE
True or False: Public, static and void are sample of Java reserved
keywords.
Answer:
true

Observe the following statements and decide whether the


variable result’s value is TRUE or FALSE.
Given that:
int x = -77;
Question 1 False
Complete
Mark 1.00 out of 1.00
Question 4
Question text Complete
Mark 1.00 out of 1.00
True or False: Brackets [] are also separators used in declaring
Question text
arrays.
Answer: Read each statement carefully and decide whether it’s
True
TRUE or FALSE.

Question 2
Complete
Mark 1.00 out of 1.00 If you run this program, the second line of output will read Your
Question text score is:

True or False: Operators, in Java programming language, use


special symbols to call methods and their objects.
Select one:
Answer: True
False
False
Question 3 Question 5
Complete Complete
Mark 1.00 out of 1.00 Mark 1.00 out of 1.00
Question text Question text
Observe the following statements and decide whether the Read each statement carefully and decide whether it’s
variable result’s value is TRUE or FALSE.
TRUE or FALSE.
Given that:
int x = -77;
int z = 43;
result = -(-z) == 43; The last line of code, with a close brace { symbol, is properly
indented.
Select one:
Select one:
True
True Question 8
Complete
False Mark 1.00 out of 1.00

Question 6 Question text


Complete
Mark 1.00 out of 1.00
Refer to the block of codes below. Read each statement carefully
and decide whether it’s TRUE or FALSE.
Question text
Observe the following statements and decide whether the The person’s weight is declared correctly with the correct data
variable result’s value is TRUE or FALSE. type (byte) and value (160).
Given that: Answer:
FALSE
int x = -77;
int z = 43;
Question 9
result = (z < x && 1 != 10) ? true : false; Complete
Mark 1.00 out of 1.00

Question text

Read each statement carefully and decide whether it’s


Select one:
TRUE or FALSE.
True
False The second line of output will be: You are in Year 11.
Question 7 Select one:
Complete
Mark 1.00 out of 1.00 True

Question text False

Refer to the block of codes below. Read each statement carefully Question 10
and decide whether it’s TRUE or FALSE. Complete
Mark 1.00 out of 1.00

In line 11, the value of personage is 18. Question text

Answer: Refer to the block of codes below. Read each statement carefully
and decide whether it’s TRUE or FALSE.
TRUE
The last line of code will output 100.0.
Answer:
TRUE
Question 1 Assuming there are no errors in the code, line 13 would display
Complete When I graduate, I’d be 18.
Mark 1.00 out of 1.00
Answer:
Question text TRUE

Read each statement carefully and decide whether it’s


TRUE or FALSE. Question 4
Complete
Mark 1.00 out of 1.00
If there are no errors and this simple program runs through CLI, Question text
the first line will display: Hi, students!
Refer to the block of codes below. Read each statement carefully
Select one: and decide whether it’s TRUE or FALSE.
True
False If there are no errors in the program, line 9 would display I weigh
160.
Question 2
Complete Answer:
Mark 1.00 out of 1.00 FALSE

Question text
Question 5
Refer to the block of codes below. Read each statement carefully Complete
and decide whether it’s TRUE or FALSE. Mark 1.00 out of 1.00

Question text
There are no errors on line 8.
True or False: Semicolon (;) is a separator used to end a Java
Answer: statement.
FALSE
Answer:
True
Question 3
Complete
Mark 1.00 out of 1.00 Question 6
Complete
Question text Mark 1.00 out of 1.00

Refer to the block of codes below. Read each statement carefully Question text
and decide whether it’s TRUE or FALSE.
True or False: When you run javac in a command line interface, it Answer:
will automatically create another file with a filename extension True
.class.
Answer: Question 9
Complete
True Mark 1.00 out of 1.00

Question 7
Question text
Complete
Observe the following statements and decide whether the
Mark 1.00 out of 1.00
variable result’s value is TRUE or FALSE.
Question text
Given that:
Read each statement carefully and decide whether it’s int x = -77;
TRUE or FALSE.
int z = 43;
result = !((x * 10) < z);

Select one:
True
False
figure shows the Netbeans Integrated Development Environment.
Question 10
Select one: Complete
True Mark 1.00 out of 1.00

False Question text

Question 8
True or False: Logical OR operator will result to false if one of the
Complete expressions is false.
Mark 1.00 out of 1.00
Answer:
Question text False

True or False: The conditional AND operator uses two


ampersand (&&) symbols. Question 2
Complete
Question 6
Mark 1.00 out of 1.00
Complete
Question text Mark 1.00 out of 1.00

True or False: Public, private and protected are some of the Question text
return types used in Java programming. Determine the output.
Answer:
False
Select one:
Question 3 a. 123
Complete
Mark 1.00 out of 1.00
b. 169
c. error
Question text
d. 155

Question 9
TRUE OR FALSE: This is an example of concatenation. Complete
Mark 1.00 out of 1.00
Select one:
True Question text

False True or False: Divide and conquer strategy, in programming, is


also known as the top-down design.
Question 4
Complete Answer:
Mark 1.00 out of 1.00 True

Question text
Question 15
Determine the output. Complete
Mark 1.00 out of 1.00

Question text
Select one:
True or False: You’ll know that a variable is a class variable when
a. error you see that variable inside a class with the word static.
b. 4298
Answer:
c. 5698 True
d. 6492
Question 17 True
Complete
Mark 1.00 out of 1.00 False
Question text Question 20
Complete
Strings can be declared with str. Mark 1.00 out of 1.00

Select one: Question text


True True or False: Variable names in Java are not necessarily case
False sensitive.

Question 18
Complete
Mark 1.00 out of 1.00

Question text Answer:


False
Determine the output.
Question 1
Complete
Select one: Mark 1.00 out of 1.00

a. 4 Question text
b. 36 True or False: Procedural programming involves instructing the
c. error system as to how to complete a task.
d. 351 Answer:
True
Question 19
Complete
Mark 1.00 out of 1.00 Question 2
Complete
Question text Mark 1.00 out of 1.00

Question text

TRUE OR FALSE: The output of this code is “The quick True or False: Variable 1st_num is a good variable name in Java
brown fox” programming.

Select one:
Answer: Question 11
False Complete
Mark 1.00 out of 1.00
Question 5
Complete Question text
Mark 1.00 out of 1.00
Languages which use procedural programming include
Question text C++
C, Answer , FORTRAN, Pascal and BASIC.
True or False: Local variables are declared inside the default
method. Question 12
Complete
Answer: Mark 0.00 out of 1.00
False
Question text
Question 9 Determine the output.
Complete
Mark 1.00 out of 1.00

Question text Select one:


Strings can be declared with str. a. bar
Select one: b. foobar
True c. error
False d. foo

Question 10 Question 13
Complete Complete
Mark 1.00 out of 1.00 Mark 1.00 out of 1.00

Question text Question text

True or False: Variable names in Java are not necessarily case In procedural programming, a step-by-step sequence of
Task
sensitive. instructions is followed to perform a Answer .
Answer: Question 14
False Complete
Mark 1.00 out of 1.00
Question text Question text
True or False: Instance variables are declared inside a method
but outside a class.
TRUE OR FALSE: This is an example of concatenation.
Answer:
Select one:
False
True
Question 15 False
Complete
Mark 1.00 out of 1.00 Question 18
Complete
Question text Mark 1.00 out of 1.00

Question text
TRUE OR FALSE: The output of this code is “The quick
brown fox”
TRUE OR FALSE: “val_2” contains “The”.
Select one:
Select one:
True
False
True
Question 16 False
Complete
Mark 1.00 out of 1.00 Question 19
Complete
Question text Mark 1.00 out of 1.00
True or False: Divide and conquer strategy, in programming, is Question text
also known as the top-down design.
True or False: You’ll know that a variable is a class variable
Answer: when you see that variable inside a class with the word static.
True
Answer:
True
Question 17
Complete
Mark 1.00 out of 1.00 Question 20
Complete
Mark 1.00 out of 1.00

Question text
Fill in the blank: In designing the program specification,
Output
determine first the input, then the Answer and then
analyze the problem.
Question 1
Answer saved

Marked out of 1.00

Flag question

Question text
Method invocations are statements
Flag question
Select one:
Question text
Refer to the block of codes below. Read each statement carefully a. False
and decide whether it’s TRUE or FALSE.
b. True

Question 3
Answer saved

Marked out of 1.00

Line 9 comment can also be changed to another type of comment


Flag question
by replacing // with /* and it will function the same.
Answer: Question text
FALSE A reference variable can be reassigned to other objects provided
that it is not declared ________.
Question 2
Answer saved Select one:

Marked out of 1.00


a. Inheritance

b. Final
Marked out of 1.00
c. Abstract class

d. Directly

e. Parent class

f. Encapsulation Flag question

Question text
g. Private
True or False: In this expression – counter++ - a value of 1 is
h. More than one added to counter twice.

Answer:
i. Different forms True

j. Super class
Question 6
Answer saved
Question 4
Answer saved Marked out of 1.00

Marked out of 1.00

Flag question

Flag question Question text


Question text Fill in the blank:
True or False: A method could be declared without any
parameters.

Answer:
False

Question 5
Answer saved
Answer:
a. False
barfoo

b. True
Question 7
Answer saved Question 9
Answer saved
Marked out of 1.00
Marked out of 1.00

Flag question
Flag question
Question text
Question text
True or False: Keywords are Java reserved words which are used
as identifier for interface, constants and constructs.

Answer:
True TRUE OR FALSE: The assigned values of “val_1” & “val_2”
are integers.
Question 8 Select one:
Answer saved

Marked out of 1.00 True

False

Question 10
Answer saved

Flag question Marked out of 1.00

Question text
An array can be infinitely long.
Select one:
Question text
1+2+3/4*5 is an unambiguous expression
Select one:

Flag question
a. False
Question text
b. True
simplify
In programming, abstracting a problem means Answer it.
Question 13
Answer saved
Question 11
Answer saved Marked out of 1.00
Marked out of 1.00

Flag question
Flag question Question text
Question text Refer to the block of codes below. Read each statement carefully
Fill in the blank: Procedural programming is done and decide whether it’s TRUE or FALSE.
applica
because Answer cannot decide on their own what
sequence of tasks should be followed.

Question 12
Answer saved

Marked out of 1.00

There are no errors on line 11 but the variable ageFuture is not


used in the program.

Flag question
Answer: Answer:
TRUE False

Question 14 Question 16
Answer saved Answer saved

Marked out of 1.00 Marked out of 1.00

Flag question Flag question

Question text Question text


True or False: Comments are considered part of Java’s internal Fill in the blank:
documentation and it is therefore read and executed by the
compiler.

Answer:
False

Question 15
Answer saved Answer:
Marked out of 1.00 foo

Question 17
Answer saved

Marked out of 1.00

Flag question

Question text
True or False: Non-procedural programming focuses on how a
task is done rather than on what task should be done. Flag question
Question text
True or False: There are standard naming convention for Java
classes, methods, variables and constants.

Answer:
Flag question
True
Question text
Question 18
Answer saved
The term of each pass through a loop makes is called?

Marked out of 1.00 Select one:

a. cycle

b. turn around

Flag question
c. loop

Question text d. iteration


Inner class methods can be called by constructing the inner class. Question 20
Answer saved
Select one:
Marked out of 1.00
a. False

b. True

Question 19
Answer saved
Flag question
Marked out of 1.00
Question text
Determine the output.
Question 22
Answer saved

Marked out of 1.00

Select one:
Remove flag

a. error Question text

b. hodog Refer to the code snippet below. Identify what part of a method is
shown in each number (the underlined one).
c. dogehot

d. hotdog

Question 21
Answer saved

Marked out of 1.00

GIVEN: System.out.printIn("Area = " + areaRect);


Answer:
method body

Flag question
Question 23
Question text Answer saved

Marked out of 1.00


True or False: If you are running a program through CLI, the class
name and the file name should be different.

Answer:
False
Answer saved

Marked out of 1.00

Flag question

Question text
An int can be used even if it is declared outside a for-loop. Flag question

Select one: Question text


This type of declaration is discouraged: “int myArray[ ]”
a. False
Select one:
b. True
a. False
Question 24
Answer saved b. True
Marked out of 1.00
Question 26
Answer saved

Marked out of 1.00

Flag question

Question text

Strings can directly concatenated to an int. Flag question

Select one: Question text


Procedural programming will be tricky for Answer
True small
applications.
False
Question 27
Question 25 Answer saved
Marked out of 1.00

Flag question

Question text
An iteration of a loop is equivalent to one pass through. Select one:
Select one:
a. error
a. True
b. fudgee bar
b. False
c. chocolate bar
Question 28
Answer saved d. foo chocolate
Marked out of 1.00
Question 29
Answer saved

Marked out of 1.00

Flag question

Question text
Flag question
Determine the output.
Question text
The Arrays.sort( ) method sorts an array into _________ order.

Select one:

a. descending
b. None of the choices

c. All of the choices

d. ascending Flag question

e. random Question text


If-if is more logical than else-if.
Question 30
Answer saved Select one:
Marked out of 1.00
a. True

b. False

Question 32
Answer saved
Flag question
Marked out of 1.00
Question text
Loops must always have a continue or break statement.

Select one:

a. True Flag question

b. Maybe Question text


Please refer to figure 1 to answer the question below:
c. Doesn’t matter What the break statement in this example does is ________.

d. False Select one:

Question 31 a. Ends the whole instance of the loop


Answer saved

Marked out of 1.00 b. Ends an iteration of the loop.


c. Creates a new loop Read each statement carefully and decide whether it’s
TRUE or FALSE.
d. Ends the program

Question 33
Answer saved

Marked out of 1.00

Flag question

Question text
Infine for-loops can be declared as for( ){ }.
Select one: The filename of the Java file above is computesum.java.

True

False The last line of code, with a close brace { symbol, is properly
Question 34 indented.
Answer saved

Marked out of 1.00


Select one:

True

False

Question 35
Flag question Answer saved

Question text Marked out of 1.00


Marked out of 1.00

Flag question

Question text Remove flag

Refer to the block of codes below. Read each statement carefully Question text
and decide whether it’s TRUE or FALSE.
Determine the output.

Select one:

a. f o

b. o f

c. o o

d. error

There are no errors in line 11. Question 37


Answer saved
Answer:
Marked out of 1.00
TRUE

Question 36
Answer saved
Question 38
Answer saved

Marked out of 1.00

Flag question

Question text

Read each statement carefully and decide whether it’s


TRUE or FALSE. Flag question

Question text
A loop can contain no expressions or statements inside.
Select one:

a. False

b. True

Question 39
Answer saved

Marked out of 1.00

There are no bugs and errors in the program.


The last line of code, with a close brace { symbol, is properly
Flag question
indented.
Question text
Select one:
The “1” in arrayName[1] is called an ________.
True Select one:

False a. Index
b. object

c. bytes

d. 3-d or 3-dimensional Flag question

e. int[ ] Question text


Conditional statements are the same as declaration statements.
f. boolean
Select one:
g. 2-d or 2-dimensional
a. True
h. discouraged
b. False
i. 255
Question 41
Answer saved
j. Allocate
Marked out of 1.00
k. can

l. arraycopy( )

m. any
Flag question
n. Fills
Question text
o. one The equivalent of clauses in coding is?

Question 40 Select one:


Answer saved

Marked out of 1.00 a. Blocks

b. Expressions

c. Statements
Answer:
d. Paragraphs
local variable
Question 42
Answer saved Question 43
Answer saved
Marked out of 1.00
Marked out of 1.00

Flag question
Flag question
Question text
Question text
Refer to the code snippet below. Determine whether the given is
a local variable, instance variable, access modifier or a class Encapsulated data are hidden from other classes.
name.
Select one:

a. True

b. False

Question 44
Answer saved

Marked out of 1.00

Flag question

Question text

GIVEN: String bossName


Abstract methods need sub-classes to contain their
implementations.
Select one:

a. False Flag question

b. True Question text


Refer to the code snippet below. Identify what part of a method is
Question 45 shown in each number (the underlined one).
Answer saved

Marked out of 1.00

Flag question

Question text GIVEN: int getArea

The last part in a for loop setup can be an ________. Answer:


return type
Select one:
Question 47
a. decrement Answer saved

Marked out of 1.00


b. increment

c. both

d. none of the two

Question 46 Flag question


Answer saved
Question text
Marked out of 1.00
Int num = 1; for(num=num;num<=10;num++) is an acceptable Marked out of 1.00
code snippet.
Select one:

a. True
Flag question
b. False
Question text
Question 48
Answer saved Refer to the code snippet below. Identify what part of a method is
shown in each number (the underlined one).
Marked out of 1.00

Flag question

Question text
Please refer to figure 1 to answer the question below: GIVEN: public int getArea
If the increment num=num+2 is changed to num++, the final value Answer:
of num will be ________. modifier

Select one:
Question 50
Answer saved
a. 5
Marked out of 1.00
b. 10

c. 0

d. 12
Flag question
Question 49
Answer saved Question text
You cannot use inherited methods directly in a child class. What the break statement in this example does is
Select one:
________.
-Ends the whole instance of the loop
a. True The random( ) method sorts the array randomly.
-False
b. False The last part in a for loop setup can be an ________.
- both
The “1” in arrayName[1] is called an ________.
FOURTH QUARTER EXAM JAVA -Index
PROGRAMMING (PROG-111A) The continue; statement ends all the iterations of a loop.
- False
43/50 Which is not a proper increment?
- n+-;
BY: JOSHUA UNGAB Infine for-loops can be declared as for( ){ }.
- False
If-if is more logical than else-if.
(NOTE: WAG NYO SANA GAMITIN PANG - False
BEBENTA SA IBA JUSKO. SHARE NYO The else statement can be removed if not needed.
SA IBA GUYS) -True
Expressions, Statements and Blocks are like composing
sentences and paragraphs.
-True
The equivalent of clauses in coding is? You can declare a new method in the subclass which is
-Expressions not declared in the superclass.
Int num = 1; for(num=num;num<=10;num++) is an -True
acceptable code snippet. The return value of the equals( ) method is ________ .
-true -None of the choices
Loop that has a pre-determined number of iterations The Arrays.sort( ) method sorts an array into _________
-while order.
An int can be used even if it is declared outside a for- -Ascending
loop. This type of declaration is discouraged: “int myArray[ ]”
-true - True
Overload methods must be the same name as the class An if-else-if-else statement is a block.
-true
-True -0
If the increment num=num+2 is changed to num++, the Ifs and else-ifs test expressions return true or false.
final value of num will be ________. - True
-5 _______ classes increase the encapsulation of you
The term of each pass through a loop makes is called? methods and data.
-iteration - nesting
Loops must always have a continue or break statement. Constructed methods are initialized with 0 or null
-False depending on the data type.
1+2+3/4*5 is an unambiguous expression - true
-False The else statement catches whatever argument the if and
Conditional statements can contain more conditional else-if didn’t
statements. - True
- True An iteration of a loop is equivalent to one pass through.
int num = 1; - true
if(num==1 && num<=1){ 38. If we change the initial value of num in line 6 to “num
body; = 0”, the println output will be _______
} -0
The else-if statement can be used alone.
The conditional statement will _______. - false
- execute the body Abstract methods need sub-classes to contain their
byte( ][ ][ ) myArray; is an example of ________. implementations.
- An error -true
An array _______ hold objects. The method arraycopy( ) does what?
- can - Copies the contents of an array to a destination
A reference variable can be reassigned to other objects array.
provided that it is not declared ________. An array can be infinitely long.
- final - False
The test expression of conditional statement cannot A loop can contain no expressions or statements inside.
contain _______ - true
-! Conditional statements are the same as declaration
Each pass through of a loop is called a cycle. statements.
- True - False
If the increment “num = num + 2” is changed to “num = You cannot use inherited methods directly in a child
num + 1” the final output will be _______.
class.
- False
The equals( ) method compares 2 arrays.
- True
Method invocations are statements
- True
To implement encapsulation, you have to declare class
variables with the private modifier.
- True
Inner class methods can be called by constructing the Answer: val_1 + val_2
inner class.
- False
Encapsulated data are hidden from other classes.
Read each statement carefully and decide whether it’s
- True
TRUE or FALSE.

Refer to the code snippet below. Identify what part of a


method is shown in each number (the underlined one).

GIVEN: public int getArea


Answer: Method Name

The filename of the Java file above is computesum.java.


Fill in the blanks with the correct answer.
Answer: False
Refer to the code snippet below. Identify what part of a Strings can directly concatenated to an int.
method is shown in each number (the underlined one).
Answer: False

GIVEN: int getArea


Answer: Return Type

Fill in the blank:


TRUE OR FALSE: The value of “val_3” is 3
Answer: FALSE

Fill in the blank:

Answer: foo
Procedural programming will be tricky for
applications.
Answer: small
Answer: barfoo
Refer to the code snippet below. Determine whether the
given is a local variable, instance variable, access
modifier or a class name.

TRUE OR FALSE: The assigned values of “val_1” &


“val_2” are integers.
Answer: FALSE

Fill in the blank:


GIVEN: private class EmployeeRecord
Answer: access modifier

Answer: 200
True or False: A method could be declared without any
parameters.
Answer: False

Fill in the blank:

There are no errors in line 11.


Answer: TRUE
Determine the output.
Answer: foo
Refer to the block of codes below. Read each statement
carefully and decide whether it’s TRUE or FALSE.

Answer: error
True or False: Non-procedural programming focuses on Determine the output.
how a task is done rather than on what task should be
done.
Answer: False
Refer to the code snippet below. Determine whether the
given is a local variable, instance variable, access
modifier or a class name.

Answer: chocolate bar


True or False: If you are running a program through CLI,
the class name and the file name should be different.
Answer: False
Fill in the blank:

GIVEN: private class EmployeeRecord


Answer: class name
Answer: 6
The “indexOf( )” method returns the first instance of the
specified character.
Answer: True
Please refer to figure 1 to answer the question below:
If we change the initial value of num in line 6 to “num =
0”, the println output will be

GIVEN: int noOfEmployee


Answer: local variable
Answer: 0 True or False: After compiling a Java program through
Strings can readily accept int values. the CLI, run it using the java and press Enter.

Answer: True Answer: True

True or False: Keywords are Java reserved words which


are used as identifier for interface, constants and
constructs.
Answer: True
Refer to the code snippet below. Determine whether the
given is a local variable, instance variable, access
modifier or a class name.
Refer to the program below. Read each statement Question text
carefully and write the output for each line specified. Observe the following statements and decide whether the
variable result’s value is TRUE or FALSE.
Given that:
int x = -77;
int z = 43;
result = (z < x && 1 != 10) ? true : false;
result = (z != 43) ? true : false;
Select one:
False
Question text
Read each statement carefully and decide whether it’s TRUE or FALSE.
The last line of code, with a close brace { symbol, is properly indented.
Select one:
False
Question text
True or False: Brackets [] are also separators used in declaring arrays.
Answer:
True
Question text
Refer to the block of codes below. Read each statement carefully and
decide whether it’s TRUE or FALSE.
There is an error in line 9.
Answer:
TRUE
Question text
True or False: Operators, in Java programming language, use special
symbols to call methods and their objects.
Answer:
Line 22 will display on the screen. False
Question text
Answer: 1 Read each statement carefully and decide whether it’s TRUE or FALSE.
There are no errors in the program.
Select one:
False
Question text -True
Refer to the block of codes below. Read each statement carefully and
decide whether it’s TRUE or FALSE. The last line of code, with a close brace { symbol, is properly
Line 9 uses a traditional comment which uses double forward slash. indented.
Answer: False -False
Question text
True or False: Many programmers can be literate with Java Assuming there are no errors in the code, line 13 would display
programming language for it is intended to be that way. When I graduate, I’d be 18.
Answer:
-True
True
Question text Figure 2 shows the Netbeans Integrated Development
True or False: You’ll know there’s an error if you see a red circle with Environment.
an exclamation point in Netbeans IDE.
Answer: -True
True
The last line of code will output 100.0.
Question text
Observe the following statements and decide whether the variable -True
result’s value is TRUE or FALSE.
True or False: An exclamation point in Java means NOT.
Given that: Therefore, != means not equal to.
int x = -77;
int z = 43; -True
result = (z < x && 1 != 10) ? true : false;
result = (x = 100) >= z; There are two types of comments used in the program above –
Select one: end of line and Javadoc comments.
True
-True
The file is accurately named – Students.java.
result = (z < x && 1 != 10) ? true : false;
-false
-False
There are three (3) separators found in line 13.
There are keywords found in line 7.
-FALSE
-True
There is an error in line 9.
In line 11, the value of personage is 18.
-True
-TRUE
result = 90 < x || -1 < z;
If there are no errors in the program, the first line of output would True or False: Identifiers in Java are, in simple words, name that
read Hi, I’m a normal person. you give to Java class, variables and methods.
-False -True
result = (x * z + (z += 7)) >= 100; True or False: When you run javac in a command line interface, it
will automatically create another file with a filename extension
-False .class.
True or False: Logical OR operator will result to false if one of the -True
expressions is false.
Line 9 uses a traditional comment which uses double forward
-False slash.
True or False: Semicolon (;) is a separator used to end a Java -FALSE
statement.
There are five (5) separators used in line 8.
-True
-TRUE
True or False: There are five types of integer data types – byte,
short, int, long and float. There are no errors on line 8.
-False -FALSE
True or False: Single equal sign (=) is used for assigning values True or False: Syntax is basically the spelling and grammar errors
while double equal sign (==) is used in comparing values. compiled in a Java programming language. It should be avoided
in writing apps and applets.
-True
-False
True or False: Java’s ternary operator is a short hand for the if-
then-else statement which uses a question mark and a colon. True or False: Operators, in Java programming language, use
special symbols to call methods and their objects.
-True
-False
True or False: JDK or Java Design Kit is required to compile and
run Java apps and applets. If you run this program, the second line of output will read Your
score is:.
-True
-True
On line 6, average is equal to 0. But on line 9, average will be
equal to 100. True or False: Java is a low level programming language.
-False
-False -True
There are also punctuators used in line 10, in between System, True or False: Instance variables are declared inside a method
out and println, the parentheses and semicolon. but outside a class.

-TRUE -False

If there are no errors and this simple program runs through CLI, True or False: Variable names in Java are not necessarily case
the first line will display: Hi, students! sensitive.
-False -False

True or False: Brackets [] are also separators used in declaring Determine the output
arrays.
-36
-True
True or False: Public, private and protected are some of the
Substrings can contain 1 or 2 arguments. return types used in Java programming.

-true -False

True or False: Divide and conquer strategy, in programming, is


Determine the output.
also known as the top-down design.
-bar -True
The index of the letter “y” in string “Doggy” is 5. If there are no errors in the program, line 9 would display I weigh
160.
-False
-False
Determine the output.
True or False: A boolean variable can only have two values; it is
-foo
either true or false.
TRUE OR FALSE: The value “val_3” is a white space “ “.
-True
-False
result = !((x * 10) < z);
True or False: Variable 1st_num is a good variable name in Java -False
programming.
result = -(-z) == 43;
-False
-True
TRUE OR FALSE: “val_2” contains “The”
True or False: If you get an error while running the javac TRUE OR FALSE: This is an example of concatenation.
command in the CLI, it could be resolved by editing the Path
value in Environment Variables. -True

-True TRUE OR FALSE: The value of “val_4” is “fox”


True or False: The subtraction assignment operator subtracts the -False
left and right operand and assigns the difference to the operand
at the right. TRUE OR FALSE: “val_2” contains “The”.
-False -True

x += x; Determine the output.


result = x == 154; -f6
-False Languages which use procedural programming include C,
The second line of output will be: You are in Year 11. (Answer) FORTRAN, Pascal and BASIC.

-True -C++

True or False: The conditional AND operator uses two True or False: Local variables are declared inside the default
ampersand (&&) symbols. method.

-True -False

result = 43 <= z; Strings can be declared with str.


-True -False
True or False: You’ll know that a variable is a class variable when True or False: Procedural programming involves instructing the
you see that variable inside a class with the word static. system as to how to complete a task.
-True -True

The string method “length( )” returns the number of TRUE OR FALSE: The output of this code is “The quick
characters within a string. brown fox”
-True -False
A string can contain numbers. Among the expressions below which is a statement?
-True -True
Expressions can be long and complex. -Integers
-true The operator “new” allocates a memory block the size of what is
declared.
number++; is an expression
-true
-true
A class block can be an expression
For-loops has a set number of iterations before starting.
-False
-True
Statements can be expressions.
The equals( ) method can compare more than 2 arrays.
-False
-False
Integer arrays can be populated with characters.
While loops can use Booleans at test expressions.
-False
-True
Declaration clauses are declared as “number + 1”.
The test expression of the if statement is _______
-False
-less than or equal to
Loops can be stopped with a break; statement.
There are four (4) major features of an object-oriented
programming language – encapsulation, inheritance, -True
polymorphism and abstraction.
The equivalent of Paragraphs in coding is?
-True
-Expressions
Using a break; statement causes the loop to jump to the next
iteration. If statements cannot be nested in switches

-False -true

x+1 is example of a statement. The length( ) method returns the size (number of indices) has.

-False -True

number++; is a block When polymorphism is used, the Java object can only take one
form. Subclasses should have the same function with the parent
-False class.
Arrays are -False
Arrays can contain (Answer) number of elements. Switches are always used with if-else statements
-Any -False

“||” and “&&” can be used in conditional statements. True or False: The modulus operator returns the remainder of a
division operation instead of the quotient.
-True
-true
A class statement has three (3) major parts – declaration,
initialization and instantiation. Determine the output.
-False String val_1 = “564298”;

Declaring an object in Java uses the new keyword to create a -5698


new object.
Determine the output.
-False String val_1 = “35”;
Please refer to Figure 2 to answer the question below: If the -4
expression “num = 0” is changed to “num = 5” the final output will
be The return value of the length( ) method is an integer

-5 -true

Expressions can be statements. A superclass is also known as a parent class.

-True -true

Blocks can contain more blocks of code. For-loops can be nested in while loops.

-True -true

If-else statements can be nested in? In instantiating an object, the keyword instance is used.

-All of the choices -False

Statements are equivalent to paragraphs. Object oriented programming utilizes the top down method

-False -False

A (answer) array is an array containing true or false values. Expressions are like clauses.

-boolean -true
The sort( ) method is always ascending. -bar
-true Determine the output.
Arrays are data types. String val_1 = “foo”

-False String val_2 = “bar”

Variables must be declared as (Answer) for it to be fully hidden. val_2 = val_1;

-private val_1 = val_3;

While statements check the test expression at the end. System.out.println(val_2);

-False -foo

The else statement can be used alone. Switches can work properly even without the “break” expression.
-False -True

The fill( ) method (Answer) the array with specific values. Blocks can be one liner or huge classes.

-Fills -True

The output of println is The test expressions in conditional statements can be left empty.

-55555 -False

The person’s weight is declared correctly with the correct data Abstraction works by hiding the implementation details and
type (byte) and value (160). showing only the functions necessary.

-FALSE -True

Determine the output. A single array can hold multiple data types
String val_1 = “foo” -False

String val_2 = “bar” A polymorphic object can pass more than one Is-a test.
val_2 = val_1; -True

val_1 = val_3; Another loop can be used as test expression.

System.out.println(val_1); -False
True or False: Public, static and void are sample of Java reserved Abstraction shows the every bit of detail and implementation on
keywords. how an application does something.
-True -False
The value of “pStr” in line 24 is Initialization is a process where the constructor is called for.
-True -True

The default syntax of a constructor is <class_name>(parameter, The default syntax of a constructor is <class_name>( ){ }
parameter){ }
-True
-False
Classes cannot be nested.
A nested class is not an inner class.
-False
-False
Abstract classes cannot have nested classes.
Nested classes causes them to become abstracted
-False
-False
The parent class of a nested class is called an outer class
A nested class is also called
-True
-inner class
An inner class can be constructed directly without reference to
If you want some variables and methods hidden from other the outer class.
classes, you could implement encapsulation where these
-False
variables and methods are wrapped in a single unit.
-True Arrays can be read backwards
-True
A constructor can only have 1-2 overloads or parameters.
-False A single array can hold

All possible data types of an array can be retuned as a string by -One data type
the toString( ) method. Abstracted methods already have implementations inside.
-True -False
Abstracted classes can contain 1 or more abstract methods. are special methods to initialize objects.
-True
-constructors Parallelsorting utilizes
Constructors have 3 basic rules to follow. -More cpu processing cores
-False method can copy one array to another.
Nesting classes increases encapsulation. -arraycopy()
-True LONG QUIZ PROG 112
LONG QUIZ 3
Each index can only contain (Answer) element. 1.Fill in the blanks with the correct answer.
-one Choose the appropriate word from the given
choices.
The sort( ) method can be set to sort only a part of an array. A.A large amount of nested loops are
___________, due to the time and effort it takes
-False to execute.
ANSWER: discouraged
Subclasses or child classes could have different behaviors but B. After a for loop checks the test expression,
still share the same functions from their parent class. it executes the ___________
-True ANSWER: BODY
C.for(int x=0;x<9;x++), What is the last value
Abstract methods must have an explicit return value of ‘x’ at the end of the loop given there are no
break or continue statement inside? _________
-False ANSWER: 9
D. ___________ statement can stop a loop from
An abstract class must not contain abstract methods. performing anymore iterations.
-False ANSWER: BREAK
E.___________ are best kind of loop to use when
Abstracted classes can be nested. the number of iterations is pre-calculated.
ANSWER: for/for loops
-True F. The difference between while and do-while
loops is do-while loops test expression is at
A subclass constructor cannot invoke a superclass constructor.
the ___________
-False ANSWER: END
G.___________ is the term for ever cycle the
A class acquiring fields and methods of another class is called loop makes.
inheritance. ANSWER: ITERATION
H.for(___________) is an infinite for-loop
-True ANSWER: ;;
I. Loops can be nested inside other ___________
ANSWER: LOOP is changed to _______ then the value of “pStr”
J. ___________ loop checks the test expression in line 24 will be changed as well
at the end. ANSWER: TRUE
ANSWER: DO-WHILE 11. Please refer to Figure 2 to answer the
K. The ___________ makes a loop end a cycle question below: The value of “pStr” in line 24
prematurely and start the next iteration is _______
ANSWER: CONTINUE ANSWER: TRALSE
L.___________ are what’s inside the parentheses 12. Statements are equivalent to paragraphs
( ) after the ’for’ ANSWER: FALSE
ANSWER: Test expression 13. The else statement can be used alone
M. The short form of “num = num + 1; is ANSWER: FALSE
ANSWER: num++ 14.The equivalent of Paragraphs in coding is?
N.___________ loops are loops within loops. ANSWER: BLOCKS
ANSWER: NESTED 15. The test expressions in conditional
In a set of nested loops, the___________ most is statements can be left empty.
executed the most times ANSWER: FALSE
ANSWER: INNER 16. What can come before an else statement?
2.A class block can be an expression ANSWER: ALL OF THE CHOICES.
ANSWER: FALSE LONG QUIZ NO. 4
3. Among the expressions below which is a 1.A class acquiring fields and methods of
statement? another class is called inheritance.
ANSWER: number++; ANSWER: TRUE
4. Blocks can contain more blocks of code. 2. A class which contains the abstract keyword
ANSWER: TRUE in its declaration is known as an __________
5. Declaration clauses are declared as “number + ANSWER: Abstract class
1”. 3. A constructor ________ contain an explicit
ANSWER: FALSE return type
6. If-else statements can be nested in? ANSWER: CANNOT
ANSWER” ALL OF THE CHOICIES 4.A nested class is not an inner class
7. number++; is a block ANSWER: FALSE
ANSWER: FALSE 5. A single array can hold ________
8. Please refer to figure 1 to answer the ANSWER: ONE DATA TYPE
question below: The output of println is _______ 6.A subclass constructor cannot invoke a
ANSWER: 55555 superclass constructor
9. Please refer to Figure 2 to answer the ANSWER: FALSE
question below: Figure 2 is an example of? 7. Abstract classes cannot have nested classes
ANSWER: If-else-if nested in a switch ANSWER: FALSE
10. Please refer to Figure 2 to answer the 8.Abstracted classes can be nested
question below: If the value of “pStr” in line 7 ANSWER: TRUE
9. Abstracted classes can contain 1 or more 22. The abstract keyword can be used for _______
abstract methods. and _______
ANSWER: TRUE ANSWER: methods; classes
10.Abstraction shows the every bit of detail and 23.The limit of dimensions an array can have
implementation on how an application does without errors is ________
something ANSWER 255.
ANSWER: FALSE 24. The parent class of a nested class is called
11. All possible data types of an array can be an outer class:
retuned as a string by the toString( ) method ANSWER: TRUE
ANSWER: TRUE. 25. The sort( ) method can be set to sort only a
12.An abstract class must not contain abstract part of an array.:
methods ANSWER: FALSE
ANSWER:FALSE 26. The _______ method can copy one array to
13.An array of integers should be declared as another.
________ ANSWER: arraycopy( )
ANSWER:int[ ] 27. You can also declare new fields in the child
14. Arrays can be read backwards: class which are not in the ________
ANSWER: TRUE ANSWER: PARENT CLASS
15.Byte[ ] myArray is an array of _______ 28. _______ are special methods to initialize
ANSWER: BYTES objects.
16.Each index can only contain ________ element ANSWER: CONSTRUCTORS
ANSWER: ONE 29. ________ is the process of acquiring fields
17.If you want some variables and methods hidden and methods of a parent class or super class.
from other classes, you could implement ANSWER: INHERITANCE
encapsulation where these variables and methods SHORT QUIZ PROG 112
are wrapped in a single unit.
ANSWER: TRUE SHORT QUIZ 6
18. Initialization is a process where the
constructor is called for. 1. If statements cannot be nested in switches
ANSWER: TRUE
19. Parallelsorting utilizes ________. Select one:
ANSWER: More cpu processing cores a. True
20. Polymorphism is the ability of a Java object
to take _______ b. False
ANSWER: Different forms 2. “||” and “&&” can be used in conditional statements.
21. Subclasses or child classes could have
different behaviors but still share the same Select one:
functions from their parent class a. False
ANSWER: TRUE
Select one:
b. True
3. Expressions are like clauses. a. pStr

Select one: b. switch(str)

a. True c. case “me”:

b. False d. “tralse”;
4. x+1 is example of a statement. e. no error

Select one:
a. True 7. Switches are always used with if-else statements
b. False Select one:
5. Switches can work properly even without the “break” a. True
expression.
b. False
Select one:
a. True 8. number++; is an expression
b. False
Select one:
a. True
6. Please refer to Figure 2 to answer the question below:
b. False
The error in Figure 2 is _______.

9. Among the statements below which is only an expression


Select one:
a. System.out.println(“Hi!”);
b. “string1” + “string2”
c. system.in.read( );
d. bool
e. true;

10. Expressions can be long and complex.


Select one: ANSWER: FALSE
a. True 8. Loops can be stopped with a break; statement.
b. False
ANSWER: TRUE

9. The type of loop that checks the test expression at the end.
ANSWER: Do-While
10. Which of these is a proper decrement?
ANSWER: X or x—
SHORT QUIZ 7

1. Another loop can be used as test expression.


SHORT QUIZ 7.1
ANSWER: FALSE
1. The expression int[ ] myArray = new int[10] will ________
2. For-loops can check the test expression at the end. memory that can contain 10 integers.

ANSWER: FALSE ANSWER:ALLOCATE

3. If the test expression “num <= 10” is changed to “num <= 2”, 2. It is ________ to declare an array like this: int array[];.
the final value of num would be _______.
ANSWER: discouraged
ANSWER: 4
3. The sort( ) method is always ascending.
4. The final value of num in the output is ________
ANSWER: TRUE
ANSWER: 12
5. The final output of the code snippet is _______.
4. Arrays are_______.
ANSWER 12
ANSWER: OBJECTS
6. While statements check the test expression at the end.
5. An array is always an _______.
ANSWER: FALSE
ANSWER: OBJECT
7. Using a break; statement causes the loop to jump to the next
6. A _______ array is an array containing true or false values.
iteration.
ANSWER: BOOLEAN
7. Integer arrays can be populated with characters. 6. When polymorphism is used, the Java object can only take one
form. Subclasses should have the same function with the parent
ANSWER:FALSE class.
8. The fill( ) method _______ the array with specific values. ANSWER: FALSE
ANSWER: FILLS 7. Declaring an object in Java uses the new keyword to create a
9. String[ ][ ][ ] myArray is a declaration of ________ array. new object.

ANSWER: 3-d or 3-dimensional ANSWER: FALSE

10. A single array can hold multiple data types 8. Variables must be declared as _______ for it to be fully hidden.

ANSWER: FALSE ANSWER: PRIVATE


9. _______ is also known as a parent class.

SHORT QUIZ 8 ANSWER: SUPER CLASS

1. Abstraction works by hiding the implementation details and 10. Inherited fields and methods can be used _______ by child
showing only the functions necessary. classes.

ANSWER: TRUE ANSWER: DIRECTLY

2. is one of the four fundamental concepts, this is also known as


data hiding.
SHORT QUIZ 8.1
ANSWER: ENCAPSULATION
1. Constructors can have ________ overloads
3. A child class inherits all the methods of every other class.
ANSWER: ANY NUMBER
ANSWER: FALSE
2. A nested class is also called _______
4. Polymorphic objects can pass ________ Is-a test.
ANSWER: INNER CLASS
ANSWER: MORE THAN ONE
3. The default syntax of a constructor is <class_name>( ){ }
5. A polymorphic object can pass more than one Is-a test.
ANSWER: TRUE
ANSWER:TRUE
4. The default syntax of a constructor is
<class_name>(parameter, parameter){ }
ANSWER: FALSE
5. The terms nested and inner can be used _______

ANSWER: interchangeably
6. Classes cannot be nested.
ANSWER: FALSE
7. Constructors have 3 basic rules to follow.

ANSWER: FALSE
8. A constructor can only have 1-2 overloads or parameters.
ANSWER: FALSE

9. An inner class can be constructed directly without reference to


the outer class.
ANSWER: FALSE
10. Abstracted methods need _______ for implementations.S

ANSWER: SUB-CLASSES
FOURTH QUARTER EXAM

1. The method arraycopy( ) does what? 5. If the increment num=num+2 is changed to num++, the final value of num will be
________.
Select one:
Select one:
a. Copies the contents of an array and makes a new one.
a. 0
b. Create multiple array duplicates.
b. 10
c. Copies the contents of an array and deletes the old one.
c. 5
d. Copies the contents of an array to a destination array.
d. 12

2. Loop that has a pre-determined number of iterations


6. If we change the initial value of num in line 6 to “num = 0”, the println output will be
Select one: _______
a. for Select one:
b. all of the choices a. 0
c. while b. 12345
d. none of the choices c. error
e. do-while d. 55555

3. The else-if statement can be used alone. 7. The else statement catches whatever argument the if and else-if didn’t
Select one: Select one:
a. True a. False
b. False b. True

4. An iteration of a loop is equivalent to one pass through. 8. byte( ][ ][ ) myArray; is an example of ________.
Select one: Select one:
a. False a. An error
b. True b. A 3-dimensional array

c. A 2-dimensional array

d. A Byte array
9. An array can be infinitely long. 13. The equivalent of clauses in coding is?

Select one: Select one:

a. Paragraphs
a. False
b. Statements
b. True
10. An array can be infinitely long. An array can be infinitely long. c. Blocks

Select one: d. Expressions


14. Loops must always have a continue or break statement.
a. True
Select one:
b. False
11. A reference variable can be reassigned to other objects provided that it is not a. Doesn’t matter
declared ________
b. False
Select one:
c. True
a. Parent class
d. Maybe
b. Encapsulation

c. Private 15. Constructed methods are initialized with 0 or null depending on the data type.

d. Super class Select one:

e. Directly a. True

f. More than one b. False

g. Different forms
16. Conditional statements are the same as declaration statements.
h. Final
Select one:
i. Inheritance
a. True
j. Abstract class
12. The return value of the equals( ) method is ________ . b. False
17. The “1” in arrayName[1] is called an ________.
Select one:
Select one:
a. All of the choices
a. boolean
b. A double
b. any
c. An int
c. int[ ]
d. A string
d. Fills
e. None of the choices
e. Allocate
Select one:
f. Index
a. same
g. object
b. constructors
h. bytes
c. nesting
i. one
d. sub-classes
j. 3-d or 3-dimensional
e. methods
k. arraycopy( )
f. any number
l. can
g. classes
m. discouraged
h. inner class
n. 2-d or 2-dimensional
i. interchangeably
o. 255
j. cannot

18. Which is not a proper increment?


21. What the break statement in this example does is ________.
Select one:
Select one:
a. n+n;
a. Ends an iteration of the loop.
b. n+-;
b. Ends the whole instance of the loop
c. n+2;
c. Ends the program
d. n
d. Creates a new loop
e. n++;

f. n 22. You cannot use inherited methods directly in a child class.

Select one:

a. True

b. False
19. This type of declaration is discouraged: “int myArray[ ]”

Select one:

a. False

b. True 23. An int can be used even if it is declared outside a for-loop.

Select one:
20. _______ classes increase the encapsulation of you methods and data
Select one:
a. True
a. True
b. False
b. False

24. The last part in a for loop setup can be an ________.

Select one:

a. decrement

b. none of the two


29. The Arrays.sort( ) method sorts an array into _________ order.
c. both

d. increment Select one:


25. Expressions, Statements and Blocks are like composing sentences and
a. descending
paragraphs.
b. random
Select one:
c. ascending
a. True
d. None of the choices
b. False
e. All of the choices

26. If the increment “num = num + 2” is changed to “num = num + 1” the final output
will be _______. 30. An if-else-if-else statement is a block.

Select one: Select one:

a. 12 a. True

b. 10 b. False

c. 2
31. The else statement can be removed if not needed.
d. 0
Select one:
27. The random( ) method sorts the array randomly. a. False

Select one: b. True

a. True
32. If-if is more logical than else-if.
b. False
Select one:
28. 1+2+3/4*5 is an unambiguous expression a. False
Select one:
b. True
a. False

33. Infine for-loops can be declared as for( ){ }. b. True

Select one:
39. Ifs and else-ifs test expressions return true or false.
True
Select one:
False
a. True

34. Method invocations are statements b. False


40 . Encapsulated data are hidden from other classes.
Select one:
Select one:
a. True
a. False
b. False
b. True

35. Each pass through of a loop is called a cycle.


41. Inner class methods can be called by constructing the inner class.
Select one:
Select one:
a. True
a. True
b. False
b. False
42. The continue; statement ends all the iterations of a loop.
36. A loop can contain no expressions or statements inside.
Select one:
Select one:
a. True
a. True
b. False
b. False 43. Conditional statements can contain more conditional statements.

Select one:
37. Overload methods must be the same name as the class
a. True
Select one:
b. False
a. True 44. Int num = 1; for(num=num;num<=10;num++) is an acceptable code snippet.

b. False Select one:

a. False
38. You can declare a new method in the subclass which is not declared in the
b. True
superclass.
45. The term of each pass through a loop makes is called?
c. go to the else statement
Select one:
d. skip the body
a. turn around

b. iteration 49. An array _______ hold objects.

c. cycle Select one:


d. loop a. arraycopy( )

b. 3-d or 3-dimensional
46. The test expression of conditional statement cannot contain _______
c. Index
Select one:
d. object
a. !
e. Allocate
b. <
f. bytes

g. 255
47. The equals( ) method compares 2 arrays.
h. Fills
Select one:
i. int[ ]
a. True
j. boolean
b. False
k. 2-d or 2-dimensional

l. one

m. any

n. discouraged

48. In the code snippet: o. can


50. Abstract methods need sub-classes to contain their implementations.
int num = 1;
if(num==1 && num<=1){ Select one:
body;
a. False
}
b. True
The conditional statement will _______.
Select one:

a. execute the body

b. produce an error
e. Fills
Question 1
Complete f. Allocate
Mark 1.00 out of 1.00
g. can
h. boolean
i. Index
j. 255
Flag question k. int[ ]
Question text l. discouraged
number++; is an expression m. one
Select one: n. object
a. False o. any
b. True Question 3
Complete
Question 2 Mark 1.00 out of 1.00
Complete
Mark 1.00 out of 1.00

Flag question

Flag question Question text


Question text Arrays can contain ________ number of elements.
A _______ array is an array containing true or false values. Select one:
Select one: a. boolean
a. 2-d or 2-dimensional b. Index
b. arraycopy( ) c. Fills
c. 3-d or 3-dimensional d. 255
d. bytes e. 2-d or 2-dimensional
f. discouraged Question 5
Complete
g. arraycopy( ) Mark 1.00 out of 1.00

h. 3-d or 3-dimensional
i. bytes
j. object
k. int[ ] Flag question
l. can Question text
m. one
Please refer to figure 1 to answer the question below:
n. Allocate The output of println is _______
o. any

Question 4
Complete
Mark 1.00 out of 1.00

Remove flag

Question text
Which of these is a proper decrement?
Select one: Select one:
a. x-10; a. 55555
b. x++; b. 0
c. x c. error
d. x d. 12345
e. x -- 10
Question 6
f. x+-; Complete
Mark 1.00 out of 1.00
Flag question Flag question

Question text Question text


The fill( ) method _______ the array with specific values. While statements check the test expression at the end.
Select one: Select one:
a. int[ ] a. False
b. 3-d or 3-dimensional b. True
c. Allocate Question 8
d. boolean Complete
Mark 1.00 out of 1.00
e. bytes
f. 255
g. Fills
h. object
Flag question
i. 2-d or 2-dimensional
j. discouraged Question text

k. can A single array can hold multiple data types


l. Index Select one:
m. one a. False
n. arraycopy( ) b. True
o. any
Question 9
Complete
Question 7 Mark 1.00 out of 1.00
Complete
Mark 1.00 out of 1.00
Flag question Flag question

Question text Question text


String[ ][ ] myArray is a declaration of ________ array. x+1 is example of a statement.
Select one: Select one:
a. can a. True
b. bytes b. False
c. int[ ] Question 1
d. discouraged Complete
Mark 1.00 out of 1.00
e. any
f. Fills
g. one
h. boolean
Flag question
i. Allocate
j. Index Question text

k. 3-d or 3-dimensional Please refer to figure 1 to answer the question below:


The test expression of the if statement is _______
l. 255
m. object
n. 2-d or 2-dimensional
o. arraycopy( )

Question 10
Complete
Mark 1.00 out of 1.00
b. False

Question 3
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Another loop can be used as test expression.
Select one:
Select one:
a. less than
a. True
b. greater than or equal to
b. False
c. greater than
Question 4
d. less than equal to Complete
Mark 1.00 out of 1.00
Question 2
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Flag question
_________ is also known as a parent class.
Question text
Select one:
Integer arrays can be populated with characters.
a. Abstract class
Select one:
b. Final
a. True
c. Inheritance
d. Different forms
e. Private
f. Directly
g. More than one
h. Parent class
i. Super class
j. Encapsulation

Question 5
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Please refer to Figure 2 to answer the question below:
If the value of “pStr” in line 7 is changed to _______ then the
value of “pStr” in line 24 will be changed as well.

Select one:
a. you
b. tralse
c. default
d. True
Question 6
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Flag question
Please refer to figure 1 to answer the question below: The final
Question text value of num in the output is ________

________ is one of the four fundamental concepts, this is also


known as data hiding.
Select one:
a. Final
b. Super class
c. Inheritance
d. Parent class
e. Different forms
f. Private
g. Directly
h. More than one
i. Encapsulation
j. Abstract class
Select one:
Question 7 a. 10
Complete
Mark 1.00 out of 1.00 b. 0
c. 5
d. 12

Question 8
Complete
Mark 0.00 out of 1.00

Flag question
Remove flag
Question text
Question text
Please refer to Figure 2 to answer the question below:
Conditional test expressions can contain declarations The value of “pStr” in line 24 is _______.
Select one:
a. True Select one:
Question 9
Complete
a. tralse
Mark 1.00 out of 1.00 c. True
d. you

Flag question

Question text
Blocks can be one liner or huge classes.
Select one:
a. True
b. False

Question 10
Complete
Mark 0.00 out of 1.00
Please refer to Figure 2 to answer the question below:
c. case “me”:
The error in Figure 2 is _______.
d. no error
e. switch(str)

Question 2
Complete
Mark 1.00 out of 1.00

Flag question

Question text
“||” and “&&” can be used in conditional statements.
Select one:
a. False
b. True

Question 3
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Select one: Statements are equivalent to paragraphs.


a. “tralse”; Select one:
b. pStr a. False
b. True

Question 4
Complete
Mark 1.00 out of 1.00
Flag question Flag question
Question text Question text
Loops can be stopped with a break; statement. Expressions can be statements.
Select one: Select one:
a. False a. False
b. True b. True
Question 5 Question 7
Complete Complete
Mark 1.00 out of 1.00 Mark 1.00 out of 1.00

Flag question Flag question


Question text Question text
The sort( ) method is always ascending. The return value of the length( ) method is an integer
Select one: Select one:
a. True a. False
b. False b. True
Question 6 Question 8
Complete Complete
Mark 1.00 out of 1.00 Mark 0.00 out of 1.00
Question text
If you want some variables and methods hidden from other
classes, you could implement encapsulation where these
variables and methods are wrapped in a single unit.
Flag question Select one:
Question text a. False
The operator “new” allocates a memory block the size of what is b. True
declared.
Question 4
Select one: Complete
Mark 1.00 out of 1.00
a. True
Question 1
Question text
Complete
The default syntax of a constructor is <class_name>(parameter,
Mark 0.00 out of 1.00
parameter){ }
Question text
Select one:
Initialization is a process where the constructor is called for.
True
Select one: False
b. True
Question 5
Question 2 Complete
Mark 1.00 out of 1.00
Complete
Mark 1.00 out of 1.00
Question text
Question text The _______ method can copy one array to another.
The default syntax of a constructor is <class_name>( ){ }
Select one:
Select one: a. any
True b. Allocate
False c. 2-d or 2-dimensional
Question 3 d. boolean
Complete
Mark 1.00 out of 1.00
e. discouraged
f. can
Complete
g. one Mark 1.00 out of 1.00
h. 3-d or 3-dimensional Question text
i. int[ ]
_______ are special methods to initialize objects.
j. Index
Select one:
k. arraycopy( )
a. classes
l. Fills
b. interchangeably
m. 255
c. any number
n. object
d. nesting
o. bytes
e. cannot
Question 7 f. same
Complete
Mark 1.00 out of 1.00 g. methods
Question text h. sub-classes
The parent class of a nested class is called an outer class i. inner class
j. constructors
Select one:
a. True Question 10
Complete
b. False Mark 1.00 out of 1.00

Question 8 Question text


Complete
Mark 1.00 out of 1.00 Constructors can have ________ overloads
Question text Select one:
A class acquiring fields and methods of another class is called a. interchangeably
inheritance. b. sub-classes
Select one: c. nesting
a. True d. same
b. False e. cannot

Question 9
f. constructors
g. methods b. False
h. any number Question 16
i. inner class Complete
Mark 1.00 out of 1.00
j. classes
Question text
Question 12
Complete
Arrays can be read backwards
Mark 1.00 out of 1.00
Select one:
Question text a. False
Abstract classes cannot have nested classes. b. True
Select one: Question 17
a. False Complete
Mark 1.00 out of 1.00
b. True
Question text
Question 13
Complete
Parallelsorting utilizes ________.
Mark 1.00 out of 1.00
Select one:
Question text a. More cpu processing cores
Nesting classes increases encapsulation. b. More memory
Select one: c. More sorting methods
a. True d. The video card
b. False uestion 20
Complete
Question 14 Mark 1.00 out of 1.00
Complete
Mark 1.00 out of 1.00 Question text
Question text An abstract class must not contain abstract methods.
Abstracted methods already have implementations inside. Select one:
Select one: a. False
a. True b. True
Question 1 A nested class is not an inner class.
Complete
Mark 1.00 out of 1.00 Select one:

Question text a. False


b. True
Classes cannot be nested.
Select one: Question 6
Complete
a. True Mark 1.00 out of 1.00

b. False Question text

Question 3 Abstract methods must have an explicit return value


Complete
Select one:

Question text a. False


b. True
The sort( ) method can be set to sort only a part of an array.
Select one: Question 7
Complete
b. False Mark 1.00 out of 1.00

Question 4
Question text
Complete
Byte[ ] myArray is an array of _______.
Mark 1.00 out of 1.00

Question text Select one:


a. any
Abstraction shows the every bit of detail and implementation on
how an application does something. b. arraycopy( )
Select one: c. bytes
a. True d. 3-d or 3-dimensional
b. False e. 255
f. Allocate
Question 5
Complete g. int[ ]
Mark 1.00 out of 1.00
h. object
Question text i. Index
Nested classes causes them to become abstracted
j. discouraged
k. one Select one:
l. can a. True
m. Fills b. False
n. boolean Question 10
Complete
o. 2-d or 2-dimensional Mark 1.00 out of 1.00

Question 8 Question text


Complete
Mark 1.00 out of 1.00 Abstracted classes can be nested.
Question text Select one:
A class which contains the abstract keyword in its declaration is a. False
known as an __________. b. True
Select one:
Question 11
a. Super class Complete
Mark 1.00 out of 1.00
b. More than one
Question text
c. Encapsulation
d. Private An inner class can be constructed directly without reference to
the outer class.
e. Inheritance
Select one:
f. Parent class
a. False
g. Different forms
b. True
h. Final
i. Abstract class Question 15
Complete
j. Directly Mark 1.00 out of 1.00

Question 9
Complete
Mark 1.00 out of 1.00

Question text
b. object
c. int[ ]
d. bytes

Flag question e. can


f. arraycopy( )
Question text
g. 3-d or 3-dimensional
Subclasses or child classes could have different behaviors but
still share the same functions from their parent class. h. one

Select one: i. 255

a. False j. discouraged

b. True k. Allocate
l. Fills
Question 16
Complete m. 2-d or 2-dimensional
Mark 1.00 out of 1.00
n. Index
Question text o. boolean
Constructors have 3 basic rules to follow.
Question 19
Select one: Complete
Mark 1.00 out of 1.00
a. False
Question text
b. True
A subclass constructor cannot invoke a superclass constructor.
Question 17
Select one:
Question 18
Complete a. True
Mark 1.00 out of 1.00
b. False
Question text
Question 20
Each index can only contain ________ element. Complete
Mark 1.00 out of 1.00
Select one:
Question text
a. any
A constructor can only have 1-2 overloads or parameters.
Select one:
a. True
b. False

You might also like