GoConqr has a new look! Let us know what you think.

Quiz

Java Week 2 Repetition

Troy Bowlin 17 questions

Take the quiz

Questions in this quiz (17)

  1. 1Which of the following statements about the 'block' statement are true
    1. Ait groups a sequence of statements into a single statement
    2. Bit conditionally executes a sequence of statements
    3. Cit is used to prevent a sequence of statements from being executed
    4. Dit is used to contain a main statement
  2. 2What output will the following code produce
    int number;
    number = 1;
    while ( number < 6) {
    System.out.print(number);
    number += 1;
    }
    1. A12345
    2. B01234
    3. C123456
    4. D13579
  3. 3What is the following java code structure known as
    for ( i=0; i<10; i++) {
    for (j=0; j<10; j++) {
    //do something
    }
    }
    1. Anested loop
    2. Bdouble loop
    3. Cexponential loop
    4. Dnone of the above
  4. 4Which best describes the code below:
    while ( true ) {
    System.out.print("loop again)'
    }
    1. Ait is an infinite loop that will continue to loop forever (until the program is terminated)
    2. Bit is an interative loop that ends when the conditional expression is false
    3. Cit is not valid java code
    4. Dnone of the above
  5. 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!");
    1. A1
      2
      3
      4
      5
      Done!
    2. B12345Done!
    3. C12345
    4. D12345
      Done!
  6. 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);
    }
    1. Amississippi
    2. Bm i s s i s s i p p i
    3. Cippississim
    4. Dnull string
  7. 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);
    }
    1. A30 frames repeated 10 times
    2. B310 frames
    3. C10 frames
    4. D30 frames
  8. 8A for loop can use a list structure such as an enum to iterate the for loop?
    1. ATrue
    2. BFalse
  9. 9The break loop when encountered will cause processing to skip to the beginning of the loop?
    1. ATrue
    2. BFalse
  10. 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?
    1. ATrue
    2. BFalse

Information

Description
AS - Level Computer Science (CS1102 Java) Quiz on Java Week 2 Repetition, created by Troy Bowlin on 02/10/2016.
Language
English
Views
0
Tags
computer sciencecs1102 javaas - level
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?