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

Quiz

CS 110 Multiple Choice Chapters 1-8

Phil McCallion 67 questions Updated 4 Jul 2017

Take the quiz

Questions in this quiz (67)

  1. 1The expression (int)(76.0252175 * 100) / 100 evaluates to _________.
    1. A76
    2. B76.0252175
    3. C76.03
    4. D76.02
  2. 2What is y after the following switch statement?
    int x = 0;
    int y = 0;
    switch (x + 1) {
    case 0: y = 0;
    case 1: y = 1;
    default: y = -1
    }
    1. A2
    2. B1
    3. C0
    4. D-1
  3. 3Assume x is 0. What is the output of the following statement?

    if (x > 0)
    System.out.print("x is greater than 0");
    else if (x < 0)
    System.out.print("x is less than 0");
    else
    System.out.print("x equals 0");
    1. Ax is less than 0
    2. Bx is greater than 0
    3. Cx equals 0
    4. DNone
  4. 4Analyze the following code:

    Code 1:

    boolean even;

    if (number % 2 == 0)
    even = true;
    else
    even = false;

    Code 2:

    boolean even = (number % 2 == 0);
    1. ACode 2 has syntax errors.
    2. BCode 1 has syntax errors.
    3. CBoth Code 1 and Code 2 have syntax errors.
    4. DBoth Code 1 and Code 2 are correct, but Code 2 is better.
  5. 5What is the output of the following switch statement?

    char ch = 'a';

    switch (ch) {
    case 'a':
    case 'A':
    System.out.print(ch); break;
    case 'b':
    case 'B':
    System.out.print(ch); break;
    case 'c':
    case 'C':
    System.out.print(ch); break;
    case 'd':
    case 'D':
    System.out.print(ch);
    1. Aab
    2. Ba
    3. Caa
    4. Dabc
    5. Eabcd
  6. 6What is x after evaluating

    x = (2 > 3) ? 2 : 3;
    1. A5
    2. B2
    3. C3
    4. D4
  7. 7Analyze the following code.

    int x = 0;
    if (x > 0);
    {
    System.out.println("x");
    }
    1. AThe value of variable x is always printed.
    2. BThe symbol x is always printed twice.
    3. CThe symbol x is always printed.
    4. DNothing is printed because x > 0 is false.
  8. 8To declare a constant MAX_LENGTH inside a method with value 99.98, you write
    1. Afinal double MAX_LENGTH = 99.98;
    2. Bdouble MAX_LENGTH = 99.98;
    3. Cfinal MAX_LENGTH = 99.98;
    4. Dfinal float MAX_LENGTH = 99.98;
  9. 9Which of the following is a constant, according to Java naming conventions?
    1. Aread
    2. BMAX_VALUE
    3. CReadInt
    4. DTest
  10. 10What is y after the following switch statement is executed?

    x = 3;
    switch (x + 3) {
    case 6: y = 0;
    case 7: y = 1;
    default: y += 1;
    }
    1. A1
    2. B4
    3. C3
    4. D2
    5. E0

Information

Description
CS 110 Quiz on CS 110 Multiple Choice Chapters 1-8, created by Phil McCallion on 04/07/2017.
Language
English
Views
10
History
Created on 4 Jul 2017 · updated on 4 Jul 2017
Tags
cs 110
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?