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

Quiz

Computer Science Final Exam Practice Combined

Christopher Castillo 44 questions

Take the quiz

This quiz has a time limit, so it opens in the usual player.

Questions in this quiz (44)

  1. 1What is the output of this block of code?
    place = 10;
    if(place == 1) {
    System.out.println("Gold Medal!");
    } else if (place == 2) {
    System.out.println("Silver Medal!");
    } else if (place == 3) {
    System.out.println("Bronze Medal!");
    } else {
    System.out.println("No medal.");
    }
    1. ASilver Medal!
    2. BGold Medal!
    3. CNo medal
    4. DNothing will print
    5. EBronze Medal
  2. 2What are the values of x and y after this code has executed?
    int x = 10;
    int y = 5;
    if (x >= y) {
          x *= y;
    } else {
          y += x;
    }
    1. Ax=50,y=5
    2. Bx=15,y=5
    3. Cx=10,y=15
    4. Dx=10,y=50
  3. 3Let's say you are running a program that needs to check if a password is correct. The correct password is "ABCDE" and it needs to match the same capitalization. The user's entry for the password will be stored in a String variable called attempt.

    Which expression below will be true if attempt is equal to the correct password?
    1. Aattempt.equals("ABCDE")
    2. Battempt="ABCDE"
    3. Cattempt.equalIgnoreCase("ABCDE")
    4. Dattempt == "ADCDE"
  4. 4How many times will this loop run?

    public class Main
    {
    public static void main(String[] args) {
    for(int i = 0; i < 10; i++) {
    System.out.println("Loop!");
    }
    }
    }
    1. A1 iteration always
    2. B5 iterations always
    3. CThis is an infinite loop
    4. DThis loop will never run
    5. EDont know- it depends on what the user enters at runtime
    6. F10 iterations always
  5. 5What is a nested loop?
    1. AThere is no such thing as a nested loop
    2. BA loop that is placed within another loop
    3. CA loop that can only run a maximum of 5 times
    4. DA loop that runs in reverse order
  6. 6What will the below block of code print?

    boolean x = 4 > 8;
    boolean y = 10 > 2;
    boolean z = x || y;
    System.out.println(z);
    1. A4
    2. Btrue
    3. Cfalse
    4. D8
  7. 7What is the difference between the == operator and the = operator?
    1. A= is the equality operator and == is the assignment operatior
    2. B== is the equality operator and = is the assignment operator
    3. Cthe == operator is never correct. = should always be used
    4. DThe two operators are interchangeable
  8. 8What are the two possible values of a while loop condition?
    1. Ayes and no
    2. BA and B
    3. Ctrue and false
    4. D-1 and 1
  9. 9What does the term "iteration" mean?
    1. AIt refers to a single "run" of a loop
    2. BIt represents a case statement
    3. CIt refers to a String variable
    4. DIt is another term for compilation
  10. 10What is the output of this block of code?

    int place = 4;
    switch (place) {
    case 1:
    System.out.println("Gold Medal!");
    break;
    case 2:
    System.out.println("Silver Medal!");
    break;
    case 3:
    System.out.println("Bronze Medal!");
    break;
    }
    1. ABronze Medal!
    2. BNothing will print
    3. CGold Medal!
    4. DSilver Medal!

Information

Description
ACCA Teaching Quiz on Computer Science Final Exam Practice Combined, created by Christopher Castillo on 17/07/2024.
Language
English
Views
7
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?