Overview Lesson #1

Below is a list of all the lessons you have learned thus far.

  1. What Is Programming?
  2. Programming Languages
  3. Binary
  4. Number Bases
  5. The Print Statement – (Hello World), Basic Syntax, and Comments
  6. Primitive Variables
  7. Advanced Variables
  8. Assignment Operators
  9. Arithmetic Operators
  10. Relational Operators
  11. Logical Operators
  12. Special Operations
  13. If Statement
  14. For Loop
  15. Advanced For Loop
  16. While Loops

Lesson Quiz

Each question in this quiz corresponds to that lesson, so if you miss a specific problem, go back to that problem’s lesson to review.

1. Programming can be used to complete simple or complex tasks.

a. True
b. False

2. Syntax is...

a. The pronunciations of different important words.
b. The act of debugging one’s code.
c. The set of rules that governs the grammar/structure of the code.

3. What is 55 (base 10) converted to binary?

a. 110111
b. 101010
c. 111000
d. 111111

4. How many bits are in a byte?

a. 2
b. 4
c. 8
d. 10

5. Which of the following statements will NOT produce an error?

a. system.out.println(“Hello World”);
b. System.Out.Println(‘Hello World’);
c. System.out.println(“Hello World”);
d. System.out.println{ “Hello World” };

6. Which of the following statements will produce an error?

a. Int x = 5;
b. boolean y = false;
c. char c = ‘c’;
d. double decimal = 10.0;

7. Is a String a primitive variable?

a. Yes
b. No

8. What is output by the code below?

    int number = 13;
    number *= 5;
    System.out.println(number);
a. *513
b. 135
c. 65
d. 13.5

9. What is output by the code below?

    int value = 16;
    int value2 = 5;
    value = value % value2;
    System.out.println(value);
a. 3
b. 1
c. 80
d. 3.1

10. Which of the following means “not equal to” in Java?

a. -=
b. /==
c. \==
d. !=

11. What is value of the statement below?

    (!(true && false) || !false) && (5+3 >= 7)
a. true
b. false
c. ERROR (code not valid)

12. Which of the following outputs 3 to the console?

a. System.out.println(1 + “” + 2);
b. System.out.println(1 + (2 + “ ”));
c. System.out.println(“” + 1 + 2);
d. System.out.println(“” + (1 + 2));

13. How many errors are in the code below?

    If (6 < 10) (
        System.out.println(“Yay”);
    }
a. 0
b. 1
c. 2
d. 3

14. What is output by the code below?

    for (int i = 10; i >= 0; i--) {
        if (i % 2 == 0) {
            System.out.println(i + 2);
        }
    }
a. 13 11 9 7 5 3
b. 12 10 8 6 4 2
c. 10 8 6 4 2
d. 10 9 8 7 6 5

15. Does the break command exit all loops if inside a nested for loop?

a. Yes
b. No
c. Sometimes (50/50 chance every time)

16. Which of the following is false?

a. The while loop uses a boolean to decide whether or not to continue to execute its body statement.
b. While loops are usually more useful than for loops when testing for whether or not a case is true/false.
c. While loops will always run once.

Written by Chris Elliott

Notice any mistakes? Please email us at [email protected] so that we can fix any inaccuracies.