Module 5 Flashcards

1
Q

Concept in which the statements of a program are executed in the order in which they occur

A

sequential flow of processing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Please select all of the clauses below which indicate an aspect of the if statement

A. Followed by an open round parenthesis

B. A conditional statement

C. Capable of assigning a value

D. Followed by one or more action clauses

E. Can alter the flow of the program execution

A

A. Followed by an open round parenthesis

B. A conditional statement

D. Followed by one or more action clauses

E. Can alter the flow of the program execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Java statement that allows the programmer to make decisions on whether a section of code executes or not

A

if statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the outcome of the following code?

do

{

System.out.println(“CS200”);
}

while (false);

A. CS200 is printed once
B. Nothing is printed
C. CS200 is printed continuously
D. CS200 is printed twice

A

A. CS200 is printed once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following keywords represent the three forms of iterative loops in Java?

A. while
B. do…while
C. each
D. for
E. begin

A

A. while
B. do…while
D. for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two main components of an iterative loop in Java?

A. Its opening and closing round parenthesis

B. The evaluation of a Boolean expression yielding either true or false

C. A subordinate scope of program code

D. The evaluation of a Boolean expression yielding either true or false

A

C. A subordinate scope of program code

D. The evaluation of a Boolean expression yielding either true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Identity all of the conditional operators which occur in the list below

A. =
B. >=
C. !=
D. +
E. &&

A

B. >=
C. !=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Select the expression or expressions below which identify the purpose of a ! sign in a conditional clause

A. Specifies the negation of an elementary equals operator

B. Precedes an if statement

C. Reverses the logical sense of a conditional clause

D. Terminates an action statement

A

A. Specifies the negation of an elementary equals operator

C. Reverses the logical sense of a conditional clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which iterative procedure in Java always executes the subscope of code at least once?

A. while

B. do…while

C. do until

D. for

A

B. do…while

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following is a valid header of the Java for statement?

A. for (double i = 1; i<=5; i++)
B. for (int i=1; i>=5; i- -)
C. for (int=1; i<=5; i++)
D. for (int i=5; i>0; i - -)
E. for (int i>1; i=5; i++)

A

C. for (int=1; i<=5; i++)
D. for (int i=5; i>0; i - -)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Compound conditional operators:

!
&&
||

A

No answer just study

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the outcome of the following code?

int a = 5, b = 10, sum = 0;

if ((a++==5) || (b++==10))
{
sum = a + b;
}
System.out.println(a + “,” + b + “,” + sum);

A. 6,10,0
B. 6, 10, 16
C. 5, 10, 17
D. 5, 10, 0

A

B. 6, 10, 16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following are true regarding the do…while iterative loop in Java?

A. The do…while loop is the only iterative loop which requires two keywords to manage it

B. The conditional clause which governs the execution of a do…while loop is a standard conditional clause like any which occur in other conditional statements

C. It is possible for the do…while loop to not execute its code in the body of the loop if the condition starts off as false

D. The do…while loop is the only type of iterative loop in which a semicolon immediately follows the closing round parentheses which enclose its conditional clause

A

A. The do…while loop is the only iterative loop which requires two keywords to manage it

D. The do…while loop is the only type of iterative loop in which a semicolon immediately follows the closing round parentheses which enclose its conditional clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In what sense are iterative procedures repetitious?

A. Iterative procedures are repetitious in that they contain programming standards

B. Iterative procedures are repetitious in that they include conditional clauses

C. Iterative procedures are repetitious in that they process the same subordinate scope of program code again and again until a condition is fulfilled

D. Iterative procedures are repetitious in that their subordinate scopes terminate with a closing curly bracket

A

C. Iterative procedures are repetitious in that they process the same subordinate scope of program code again and again until a condition is fulfilled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens if the break statement is left out of a case section in a switch statement in Java?

A. You will get a compiler error

B. Once the last statement in the case section is executed, control will flow out of the switch statement

C. You will get a runtime error

D. Once the last statement in the case section is executed, control will flow to the default case

E. Once the last statement in the case section is executed, control will flow into the next case section

A

E. Once the last statement in the case section is executed, control will flow into the next case section

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is true about the output of the following code?

for (int i = 1; i < 5; i++) {

for (int j = 2; j>0; j - - 1) {

System.out.print(j);
}

}

A. The last line of output will be: 2121212121
B. There will be 8 lines of output
C. There will be 10 lines of output
D. The first line of output will be: 2121212121
E. There will be one line of output

A

D. The first line of output will be: 2121212121
E. There will be one line of output

17
Q

Please select the name or names applied to Java program material which is enclosed within round parenthesis

A. Conditional clause

B. Parameter list

C. Logical expression

D. statement

E. Scope

A

A. Conditional clause

B. Parameter list