Name_______________________ Login___________________SID________

 

CS 010: Introduction to Computer Science I

Quiz 1: 10 minutes

 

  1. An algorithm is

a.      The inputs and outputs of a program

b.      The part of the computer that does the processing

c.      A finite set of steps to solve a problem

d.      A complete computer program

 

  1. Which of the following is NOT a valid identifier (i.e. will cause a syntax error if used as a variable name).
    1. _student_name
    2. TAXRATE
    3. %correct
    4. double1
    5. A and C are both invalid
    6. All are invalid

 

  1. A compiler translates source code written in a high-level language to object code that a machine can understand.

 

    1. TRUE
    2. FALSE

 

  1. Programs written in assembly do NOT need to be translated for the machine to understand.
    1. TRUE
    2. FALSE

 

  1. RAM?
    1. Is used to process data.
    2. Is a faster, more expensive data storage device compared to secondary storage devices.
    3. Can store data when the computer is turned off.
    4. Is the only data storage device that can store programs.
    5. B and D
    6. All the above

 

 

 

 

 

 

 

 

 

 

 

  1. The following code fragment has at least one syntax error in line(s) ___________________. (The line number and colon at the beginning of each line are for reference only and not part of the code.)

1:      int num1; num2;

2:      cout << “Enter two floating-point numbers:  “;

3:      cin >> num1; cin >> num2;

4:      cout << num1

5:              << num2;

 

    1. 1
    2. 3
    3. 4 and 5
    4. 1 and 4
    5. 1, 3, 4, and 5
    6. all lines have at least one syntax error.

 

  1. The compiler will find logic errors.
    1. TRUE
    2. FALSE

 

  1. There is a logic error in the code fragment for question 6.
    1. TRUE
    2. FALSE

 

  1. What is output to standard output (monitor) by the following statement?

cout << “Hello \nWorld!” << “Are you ready for me?”;

 

    1. Hello \nWorld!
      Are you ready for me?
    2. Hello \nWorld! Are you ready for me?
    3. Hello\n
      World!
      Are you ready for me?
    4. Hello
      World!Are you ready for me?
    5. Hello World! Are you ready for me?
    6. None of the above.

 

  1. What is the value of the variable named quotient after the following statements?

int num1 = 10;

int num2 = 20;

int quotient;

quotient = num1 / num2;

 

    1. 10
    2. 0.5
    3. 0
    4. .5
    5. None of the above (syntax error)