49 questions
What is pseudocode?
A simple java-like programming language
A control structure used in Java
Statements in plain English
A java class
What is the correct definition of an algorithm?
An algorithm is the process of breaking problems into sub-problems.
An algorithm is a software used to compute numbers.
An algorithm is a process of baking bread.
An algorithm is a step by step instructions to solve a problem.
What is the difference between a flowchart and pseudocode?
A flowchart is diagrammatic whilst pseudocode is written in a programming language (eg. Pascal or Java)
A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a textual description of an algorithm
A flowchart and pseudocode are the same thing
A flowchart is textual but pseudocode is diagrammatic
What is the purpose of pseudocode?
To program a computer
So we can see the different symbols
It helps us with the variables required
It helps us plan the code line by line
What is the value of y after evaluation: x = 7; y = ++x * 3 - 2
19
20
21
22
What type of values represent the outcome of the relational and logical operators?
constant values
Boolean values
null values
absolute values
Which of the following options is NOT a relational operator?
==
!=
&&
>=
Select the option to is equivalent to z-=10
z = 10 - z
z = z - 10
All of the above
In Java programming, selection, iteration and jump are considered to be what type of statements?
structure statements
transforming statements
control statements
directive statements
Sequence of zero or more statements enclosed in braces
Declaration Statement
Selection Statement
Return Statement
Block Statement
If-else is an example of what kind of statement?
if (time < 18)
{ System.out.println("Good day."); }
else
{ System.out.println("Good evening."); }
Expression Statement
Block Statement
Selection Statement
Return Statement
When will you use a "for loop"?
If the number of iteration is not fixed
If the number of iteration is not fixed and you must have to execute the loop at least once.
If the number of iteration is fixed
If the number of iteration is fixed and you must have to execute the loop at least once.
When will you use a "while loop"?
If the number of iteration is not fixed
If the number of iteration is not fixed and you must have to execute the loop at least once.
If the number of iteration is fixed
If the number of iteration is fixed and you must have to execute the loop at least once.
When will you use a "do-while loop"?
If the number of iteration is not fixed
If the number of iteration is not fixed and you must have to execute the loop at least once.
If the number of iteration is fixed
If the number of iteration is fixed and you must have to execute the loop at least once.
We are use for loop ..........
To repeat a specified number of operations.
To repeat a unspecified number of operations.
All answers are correct
We are use while loop ..........
To repeat a specified number of operations.
To repeat an unspecified number of operations.
All answers are correct
Which of the following would not be considered an algorithm?
a recipe
a computer program
a shopping list
pseudocode
A structure consisting of a sequence of statements enclosed in braces, functioning as if it were a single statement.
conditional expression
condition
compound statement
branch
What decision structure works best if you have more than two possible answers (multiple choice) to a question, and those answers can be integer or character based?
Nested If Statements
A Switch statement
An If statement
If else if statements
The idea that program instructions execute in order (linearly) unless otherwise specified through a conditional statement is known as
boolean execution
flow of control
conditional statements
try and catch
Of the following if statements, which one correctly executes two instructions if the condition is true?
if (x < 0)
a = b * 2;
y = x;
{ if (x <0)
a = b*2;
}
if { (x < 0)
a = b * 2;
y = x; }
if (x <0)
{ a = b*2;
y = x; }
Which of the sets of statements below will add 1 to x if x is positive and subtract 1 from x if x is negative but leave x alone if x is 0?
if (x > 0) x++;
else x--;
if (x > 0) x++;
else if (x < 0) x--;
if (x > 0) x++;
if (x < 0) x--;
else x = 0;
if (x == 0) x = 0;
else x++;
x--;
If x is an int where x = 1, what will x be after the above loop terminates?
64
100
128
None of the above, this is an infinite loop
If x is an int where x = 0, what will x be after the above loop terminates?
64
100
128
None of the above, this is an infinite loop
Given the above code, where x = 0, what is the resulting value of x after the for-loop terminates?
for(int i=0; i<5; i++)
x += i;
4
5
10
15
How many times will the above loop iterate?
0
9
10
11
statements in a program are executed one after the other in the order in which they’re written. This process is called
continuous execution
loop execution
sequential execution.
None of the above
Java statements, enable you to specify that the next statement to execute is not necessarily the next one in sequence. This is called
sequential execution.
transfer of control.
conditional execution.
All of the Above
Java supports a goto statement
True
False
Which of the following is not a selection statements
if…else statement
switch statement
if statement
while
Which of the following is/are not a selection statement(s).
if…else statement
switch statement
for
while
Which of the following is multiple-selection statement.
if…else statement
switch statement
if
None of the Above
Which of the following is not a repetition statements
while
do…while
if statement
for
Which of the following is/are not a repetition statement(s).
if…else statement
switch statement
for
while
which can be used in place of an if…else statement.
any selection statement
Conditional Operator(?:)
any repetition statement
None of the Above
Counter-controlled repetition is often called _________________
definite repetition
indefinite repetition
All of the Above
Sentinel-controlled repetition is often called _________________
definite repetition
indefinite repetition
All of the Above
Which of the following is/are not essentials of Counter-Controlled Repetition
control variable
initial value of control variable
static variable
increment
loop-continuation condition
If the Loop-Continuation Condition is omitted in for/while statement, the executes ____________
only one
zero number of times
infinite number of times
Error
If the Loop-Continuation Condition is omitted in for/while statement, Java assumes that the Loop-Continuation Condition is ______
true
false
Expressions in a for Statement’s Header are _________
Optional
Compulsory
Common uses of the break statement is/are to
to stop the execution of program
escape early from a loop
skips the remaining statements in the loop body
to skip the remainder of a switch.
Common uses of the "continue" statement is/are to
to continue the execution of program.
escape early from a loop.
skips the remaining statements in the loop body and proceeds with next iteration.
to skip the remainder of a switch.
Which of the following options is/are NOT a Logical operator?
==
||
&&
>=
Which of the following is Boolean Logical AND operator/ bitwise Operator?
&
&&
Which of the following is/are Boolean Logical operator(s)/ bitwise Operator(s)?
&
|
^
||
Which of the following is Unary Logical operator ?
&
|
^
!
Which of the following is/are can perform Short-Circuit Evaluation
&&
||
&
|
Which of the following is/are cannot perform Short-Circuit Evaluation
&&
||
&
|