HASIL QUIZ ORACLE SECTION 1-8 - Tantri
HASIL QUIZ ORACLE SECTION 1-8 - Tantri
Section 2 Quiz
(Answer all questions in this section)
1. Which of the following 2 statements are true about whitespace?
(Choose all correct answers)
Whitespace reduces the performance of the program.
Whitespace eliminates typing mistakes while programming.
Whitespace helps to keep your code organized. (*)
Whitespace increases execution time of your program.
Whitespace makes your code more readable. (*)
Correct
(1/1) Points
2. Which two are the correct syntax for adding comments?
(Choose all correct answers)
Start with a slash-star (/*). End with a star-slash (*/). (*)
Start with two slashes (//). End with two slashes (//).
Start with two slashes (//). End when the line ends. (*)
Start with two slashes and a star (//*). End with a star-slash (*/).
Start with a slash- star (/*). End with slash-star (/*).
Correct
(1/1) Points
3. A Java program can be written in the single line.
True (*)
False
Correct
(1/1) Points
4. A breakpoint can be set by clicking a number in the left margin of the IDE.
Clicking again removes the breakpoint.
True (*)
False
Correct
(1/1) Points
5. Code within curly braces is called a “Block of code”.
True (*)
False
Correct
6. You can set any number of breakpoints for your program.
True (*)
False
Correct
(1/1) Points
7. In the code example below, identify any methods:
// Fragment 2
int input = Integer.parseInt(JOptionPane.showInputDialog("??")) + 1;
True (*)
False
Correct
(1/1) Points
14. You write a statement that assigns a value to a String variable as shown below.
Statements in the loop are executed once until the condition becomes false.
Incorrect. Refer to Section 6 Lesson 2.
(0/1) Points
3. A post-test loop evaluates its condition at the end of the loop instead of the
beginning.
True (*)
False
Correct
(1/1) Points
4. Which of the two are pre-test loops?
(Choose all correct answers)
do-while
forEach
for (*)
while (*)
Correct
(1/1) Points
5. The while loop continually executes a block of statements while a particular
condition is false.
True
False (*)
Correct
(1/1) Points
6. What is the output?
11. The for loop provides a complicated way to iterate over a range of values.
True
False (*)
Incorrect. Refer to Section 6 Lesson 1.
(0/1) Points
12. A for loop is also called a definite loop
True (*)
False
Correct
(1/1) Points
13. Given:
Static
Member
Local (*)
Global
Incorrect. Refer to Section 6 Lesson 1.
(0/1) Points
14. In the given syntax of for loop, which part represents the header section?
11. Given the following code, why does your IDE complain that “non-static variable
name cannot be referenced from a static context”?
1
0
Some random number.
null (*)
Incorrect. Refer to Section 8 Lesson 1.
(0/1) Points
7. Arrays are like variables which must be declared prior to use.
True (*)
False
Correct
(1/1) Points
8. Which two are valid array declarations?
(Choose all correct answers)
int array size;
int size[]; (*)
[]int size;
int[] size; (*)
Correct
(1/1) Points
9. An array allows you to create a single identifier that can be used to organize
many items of the same data type.
True (*)
False
Correct
(1/1) Points
10. Testing and debugging are important activities in software development.
True (*)
False
Correct
(1/1) Points
Previous