Professional Documents
Culture Documents
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 TRsUE 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:
False
Question text
Read each statement carefully and decide whether it’s TRUE or FALSE.
There are no errors in the program.
Select one:
False
Question text
Refer to the block of codes below. 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
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 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 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;
result = (z < x && 1 != 10) ? true : false;
result = (x = 100) >= z;
Select one:
True
The file is accurately named – Students.java.
-false
There are three (3) separators found in line 13.
-FALSE
There is an error in line 9.
-True
result = 90 < x || -1 < z;
-True
The last line of code, with a close brace { symbol, is properly indented.
-False
Assuming there are no errors in the code, line 13 would display When I graduate, I’d be 18.
-True
Figure 2 shows the Netbeans Integrated Development Environment.
-True
-True
True or False: An exclamation point in Java means NOT. Therefore, != means not equal to.
-True
There are two types of comments used in the program above – end of line and Javadoc comments.
-True
result = (z < x && 1 != 10) ? true : false;
-False
-True
In line 11, the value of personage is 18.
-TRUE
If there are no errors in the program, the first line of output would read Hi, I’m a normal person.
-False
result = (x * z + (z += 7)) >= 100;
-False
True or False: Logical OR operator will result to false if one of the expressions is false.
-False
True or False: Semicolon (;) is a separator used to end a Java statement.
-True
True or False: There are five types of integer data types – byte, short, int, long and float.
-False
True or False: Single equal sign (=) is used for assigning values while double equal sign (==) is used
in comparing values.
-True
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
True or False: JDK or Java Design Kit is required to compile and run Java apps and applets.
-True
On line 6, average is equal to 0. But on line 9, average will be equal to 100.
-False
True or False: Identifiers in Java are, in simple words, name that you give to Java class, variables
and methods.
-True
True or False: When you run javac in a command line interface, it will automatically create another
file with a filename extension .class.
-True
Line 9 uses a traditional comment which uses double forward slash.
-FALSE
There are five (5) separators used in line 8.
-TRUE
There are no errors on line 8.
-FALSE
True or False: Syntax is basically the spelling and grammar errors compiled in a Java programming
language. It should be avoided in writing apps and applets.
-False
True or False: Operators, in Java programming language, use special symbols to call methods and
their objects.
-False
If you run this program, the second line of output will read Your score is:.
-True
True or False: Java is a low level programming language.
-False
There are also punctuators used in line 10, in between System, out and println, the parentheses and
semicolon.
-TRUE
If there are no errors and this simple program runs through CLI, the first line will display: Hi,
students!
-False
True or False: Brackets [] are also separators used in declaring arrays.
-True
-bar
-False
-True
True or False: Instance variables are declared inside a method but outside a class.
-False
True or False: Variable names in Java are not necessarily case sensitive.
-False
-36
True or False: Public, private and protected are some of the return types used in Java programming.
-False
True or False: Divide and conquer strategy, in programming, is also known as the top-down design.
-True
If there are no errors in the program, line 9 would display I weigh 160.
-False
True or False: A boolean variable can only have two values; it is either true or false.
-True
True or False: If you get an error while running the javac command in the CLI, it could be resolved
by editing the Path value in Environment Variables.
-True
True or False: The subtraction assignment operator subtracts the left and right operand and assigns
the difference to the operand at the right.
-False
x += x;
result = x == 154;
-False
The second line of output will be: You are in Year 11.
-True
True or False: The conditional AND operator uses two ampersand (&&) symbols.
-True
result = 43 <= z;
-True
True or False: You’ll know that a variable is a class variable when you see that variable inside a
class with the word static.
-True
The string method “length( )” returns the number of characters within a string.
-True
-True
-f6
Languages which use procedural programming include C, (Answer) FORTRAN, Pascal and BASIC.
-C++
True or False: Local variables are declared inside the default method.
-False
True or False: Procedural programming involves instructing the system as to how to complete a
task.
-True
TRUE OR FALSE: The output of this code is “The quick brown fox”
-False
number++; is an expression
-true
There are four (4) major features of an object-oriented programming language – encapsulation,
inheritance, polymorphism and abstraction.
-True
Using a break; statement causes the loop to jump to the next iteration.
-False
number++; is a block
-False
Arrays are
-Integers
The operator “new” allocates a memory block the size of what is declared.
-true
When polymorphism is used, the Java object can only take one form. Subclasses should have the
same function with the parent class.
-False
-Any
A class statement has three (3) major parts – declaration, initialization and instantiation.
-False
Declaring an object in Java uses the new keyword to create a new object.
-False
Please refer to Figure 2 to answer the question below: If the expression “num = 0” is changed to
“num = 5” the final output will be
-5
-boolean
True or False: The modulus operator returns the remainder of a division operation instead of the
quotient.
-true
-5698
-4
-private
-Fills
-55555
The person’s weight is declared correctly with the correct data type (byte) and value (160).
-FALSE
-bar
-foo
True or False: Public, static and void are sample of Java reserved keywords.
-True
-True
-inner class
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.
-True
All possible data types of an array can be retuned as a string by the toString( ) method.
-True
Abstraction shows the every bit of detail and implementation on how an application does something.
-False
An inner class can be constructed directly without reference to the outer class.
-False
-constructors
-one
Subclasses or child classes could have different behaviors but still share the same functions from
their parent class.
-True
Parallelsorting utilizes
-arraycopy()
=True
=bytes
Fill in the blanK.
Output:
Answer: 12
Nanpracedural programming, on the other hand, are limaed to small application* and the scope of tasks they can do.
Refer to I e program below Read each statementcaref\JlIy and write the output for each line specified
3 int counter -
4 19: int answer
5 0;
blclean result:
7 Zystem.out.prinzln{counzer);
counter++:
System.out.printlnlcountzr):
system.out.pz1nsln{counter):
12 counter /= 10;
System.out.prinz1n{counter);
14
lS System.out.printlnlresult):
16 result = (counret 1 B) - 0:
17 9ystem.ou".println{result);
answer = {counter % 4) • (counter-1);
19 System.out.prinz1n(answer);
Output:
Select one:
a. 2580
b. error
c. 200
d. 105
Read each statement carefully and decide whether it's TRUE or FALSE.
The last line of code. .I ith a close brace ( s mbol, is properl ' indented.
Select one:
True
False
A string can contain numbers.
Select one:
False
System.out.printlnlval 3}:
Mgure 1.
Select one:
False
True or False: Operator. in Java programming language. use special symbols to call methods and their objects.
are or *alse: There are nve types of integer Oaa Apes — note, sLorL ini, lonQ an0 coat.
Fill in the blanK: I n procedural programming, a step-Dy-step sequence oT instructions is followed to perform a task|
True or False. Variable 1st_ntim is a good variable name in Java programming
Output:
Select one:
a. error
b. 6492
• c. 5698
d. 4298
Determine the output.
String va1_1 = “foobar“;
int num = val_1.length( );
va1_1 = va1_1 + Integer.va1ueO(num);
val_1 = val_1,substring(0,1) + val_1,substring(6,7);
System.out.print1n(va1_1);
Output:
Select one:
a. error
b.f6
C.fOO6
d.baMb
Output:
Select one:
a. bar
b. error
c. foobar
d. loo
public static void mainlstring[] args} (
String val_l = "The qzicK Diowz Izx”;
String val_3 val_l.subsDringl0,4);
String val_3 = val_l.subsLringl9};
Stzing val_l = val_l.substxingl6,7):
System.oct.println{val_2 + "\n" + val_3 + "\n" + val_4};
Figure 2.
Select one1
True
. False
TRUE OR FALSE: The nutput of this cnde is "The quick bmvn for"
Select one.
. True
False
Quesbon @
Complete
public srauic void mais String{] args}
( Str*og val_l = "The oiick b::
Mark O.DB out of
S:x’:
1.00
Sizing val_2 = val_l.subsrring(0,fl):
@ Flag
String val_3 = val_l.substring(9):
question
Striog val_9 = val_l.substring{6,7):
System.out.println{val Z + ’\n’ + val 3 + ’\n’ + val 9}:
tgure 2.
Select one:
+ False
Output:
Select one.
• a. bar
b. loo
c. fbobar
d. error
Select one:
Ttue
False
Determine the output.
Output:
Select one:
a. error
b. 169
c. 123
d. 155