Quiz
Java Week 2 Repetition
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (17)
1Which of the following statements about the 'block' statement are true
- Ait groups a sequence of statements into a single statement
- Bit conditionally executes a sequence of statements
- Cit is used to prevent a sequence of statements from being executed
- Dit is used to contain a main statement
2What output will the following code produce
int number;
number = 1;
while ( number < 6) {
System.out.print(number);
number += 1;
}- A12345
- B01234
- C123456
- D13579
3What is the following java code structure known as
for ( i=0; i<10; i++) {
for (j=0; j<10; j++) {
//do something
}
}- Anested loop
- Bdouble loop
- Cexponential loop
- Dnone of the above
4Which best describes the code below:
while ( true ) {
System.out.print("loop again)'
}- Ait is an infinite loop that will continue to loop forever (until the program is terminated)
- Bit is an interative loop that ends when the conditional expression is false
- Cit is not valid java code
- Dnone of the above
5What will be the output of the code below:
int number;
number = 1;
while ( number < 6 ) {
System.out.print (number);
number = number + 1;
}
System.out.print("Done!");- A1
2
3
4
5
Done! - B12345Done!
- C12345
- D12345
Done!
- A1
6What will be the output of the code below:
String x = stringFunction("mississippi");
static String stringFunction(String str) {
String test;
int i;
test = "";
for (i = str.length() - 1; i >+ 0; i--) {
test = test + str.charAt(i);
}
return (test);
}- Amississippi
- Bm i s s i s s i p p i
- Cippississim
- Dnull string
7An "animation" consists of a sequence of images shown rapidly one after the other on the computer screen.
Each image i the animation is called a "frame".
Suppose that you have a subroutine
static void showFrame(int frameNum)
that displays one frame in an animation
That is, showFrame(1) display the first name showFrame(2) displays the second frame, and so on.
Suppose that there are a total of thirty different frames.
How many frames will the following code display?
for ( in play = 0; play < 10; play ++) {
for ( int i = 1; i < =30; i++)
showFrame(i);
}- A30 frames repeated 10 times
- B310 frames
- C10 frames
- D30 frames
8A for loop can use a list structure such as an enum to iterate the for loop?
- AVerdadeiro
- BFalso
9The break loop when encountered will cause processing to skip to the beginning of the loop?
- AVerdadeiro
- BFalso
10The continue statement when used in a loop will cause the flow of process to skip to the end of the loop and begin another iteration of processing?
- AVerdadeiro
- BFalso
11A for loop is used when the number of iterations through the loop is known in advance?
- AVerdadeiro
- BFalso
12The while loop is used when a known, finite number of loop iterations is required.
- AVerdadeiro
- BFalso
13The conditional expression in a while loop can be any expression that evaluates to a logical True or False?
- AVerdadeiro
- BFalso
14The while loops repeats a set of code while the condition is false.
- AVerdadeiro
- BFalso
15The do-while loop repeats a set of code at least once before the condition is tested.
- AVerdadeiro
- BFalso
16The for loop repeats a set of statements a certain number of times until a condition is matched.
- AVerdadeiro
- BFalso
17Can a for statement loop indefinitely?
- AVerdadeiro
- BFalso
Informações
- Descrição
- AS - Level Computer Science (CS1102 Java) Quiz sobre Java Week 2 Repetition, criado por Troy Bowlin em 02-10-2016.
- Autor
- Troy Bowlin
- Idioma
- English
- Visualizações
- 0
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz