midterm review jep.pdf

Upload: sunnyopg

Post on 04-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 midterm review jep.pdf

    1/15

    25/02/20

    Midterm Exam Jeopardy

    Feb 25, 2013

    Todays Categories

    Computer Systems

    Introduction to C++

    Selection Control Structures

    Repetition Control Structures

    Word Puzzle

  • 8/14/2019 midterm review jep.pdf

    2/15

    25/02/20

    ComputerSystems

    RepetitionControl

    WordPuzzle

    1 1 1

    2 2 2

    3 3 3

    4 4 4

    5

    SelectionControl

    4

    1

    2

    3

    5

    Intro toC++

    1

    2

    3

    4

    5 5 5

    Computer Systems 1 pt

    Convert the binary number

    1010110001010111

    to hexadecimal

    1 0 1 0 | 1 1 0 0 | 0 1 0 1 | 0 1 1 1

    A C 5 7

    AC5716

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    3/15

    25/02/20

    Computer Systems 2 pts

    The Central Processing Unit is primarilyresponsible for

    A. Performing program control and data processing

    B. Ensuring data persists when electrical power isturned off

    C. Enabling a human user to interact with thecomputer

    D. Interconnecting computers that are separated bydistance

    A. Performing program control and data

    processing

    Back to Board

    Computer Systems 3 pts

    Which of the following languages is unique to acomputer design where the instructions arebinary strings?

    A. assembly language

    B. Java

    C. C++

    D. machine language

    D. machine language

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    4/15

    25/02/20

    Computer Systems 4 pts

    What is the equivalent decimal value for the

    hexadecimal number A3?

    163

    Back to Board

    Computer Systems 5 pts

    What is the equivalent decimal value for the octalnumber 67?

    55

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    5/15

    25/02/20

    Intro to C++ 1 pt

    Back to Board

    High level programming languages

    A. Are made up primarily of ones and zeros

    B. Are independent of the underlying hardware

    C. Are not standardized

    D. Use syntax that is close to the underlyinghardwares instruction set

    B. Are independent of the underlying hardware

    Intro to C++ 2 pts

    Characters that are grouped togetherbetween double quotes (quotation marks) inC++ are called

    A. keywords

    B. syntax

    C. symbols

    D. strings

    d. strings

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    6/15

    25/02/20

    Intro to C++ 3 pts

    What is the output of this code snippet?

    int sum=22;sum=sum+2;cout

  • 8/14/2019 midterm review jep.pdf

    7/15

    25/02/20

    Intro to C++ 5 pts

    What is the output of the following C++expression

    y = 2 * 5 / 5 + 3 * (5 + 2)

    23

    Back to Board

    Selection Control Structures 1 pt

    What is a conditional expression?

    Back to Board

    A conditional expression is a Boolean expression that

    evaluates to true or false

    Relational operators and logical operators are used toform conditional expressions.

  • 8/14/2019 midterm review jep.pdf

    8/15

    25/02/20

    Selection Control Structures 2 pts

    Which of the following is the correct syntax foran if-else statement?

    A. if (x

  • 8/14/2019 midterm review jep.pdf

    9/15

    25/02/20

    Selection Control Structures 4 pts

    What is the problem with the following if

    statement?

    double count=15.0;if (count/3.0){

    cout

  • 8/14/2019 midterm review jep.pdf

    10/15

    25/02/20

    Repetition Control Structures 1 pt

    Which of the loops we studied executes thestatements inside the loop before checkingthe condition?

    do-while

    Back to Board

    Repetition Control Structures 2 pts

    Which common error is present in the codebelow, which is intended to calculate theaverage value from a sum of numbers?double total;

    int n;

    double input;

    while (cin>>input){

    total=total+input;n++;

    }

    if (n!=0){

    double average=total/n;}

    Uninitialized variables

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    11/15

    25/02/20

    Repetition Control Structures 3 pts

    How many times will the following loop run?

    int i=0;while (i

  • 8/14/2019 midterm review jep.pdf

    12/15

    25/02/20

    Repetition Control Structures 5 pts

    How many times is the text "Let us C" printedif the code snippet given below is run?

    2 times

    Back to Board

    int i=0;do

    {cout

  • 8/14/2019 midterm review jep.pdf

    13/15

    25/02/20

    Word Puzzle 2 pt

    The _____________ combines machine codewith library code into an executable program

    _ _ _ _ _ _

    Linker

    Back to Board

    Word Puzzle 3 pt

    Back to Board

    Binary numbers can be stored in memory asa sequence of bits, called a ____________.

    _ _ _ _

    WordExamples: 16-bit, 32-bit, and 64-bit

  • 8/14/2019 midterm review jep.pdf

    14/15

    25/02/20

    Word Puzzle 4 pt

    DAILY DOUBLE!!!DAILY DOUBLE!!!

    Word Puzzle 5 pt

    The ________ operator is a unary operatorthat requests that the value of the operandsbe changed to a new type for the nextcomputation.

    _ _ _ _

    cast

    Back to Board

  • 8/14/2019 midterm review jep.pdf

    15/15

    25/02/20

    Selection Control Structures 3 pts

    What can be done to improve the following code fragment?

    int cost=0;int counter=0;while (counter