Sei sulla pagina 1di 15

25/02/2013

Midterm Exam Jeopardy


Feb 25, 2013

Todays Categories

Computer Systems Introduction to C++ Selection Control Structures Repetition Control Structures Word Puzzle

25/02/2013

Computer Systems

Intro to C++

Selection Control

Repetition Control

Word Puzzle

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

Computer Systems 1 pt
Convert the binary number

1010110001010111
to hexadecimal
1010|1100|0101|0111 A C 5 7

AC5716
Back to Board

25/02/2013

Computer Systems 2 pts


The Central Processing responsible for Unit is primarily

A. Performing program control and data processing B. Ensuring data persists when electrical power is turned off C. Enabling a human user to interact with the computer D. Interconnecting computers that are separated by distance

A. Performing program control and data processing Back to Board

Computer Systems 3 pts


Which of the following languages is unique to a computer design where the instructions are binary strings? A. B. C. D. assembly language Java C++ machine language

D. machine language

Back to Board

25/02/2013

Computer Systems 4 pts


What is the equivalent hexadecimal number A3? decimal value for the

163

Back to Board

Computer Systems 5 pts


What is the equivalent decimal value for the octal number 67?

55

Back to Board

25/02/2013

Intro to C++ 1 pt
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 underlying hardwares instruction set

B. Are independent of the underlying hardware

Back to Board

Intro to C++ 2 pts


Characters that are grouped together between double quotes (quotation marks) in C++ are called A. keywords B. syntax C. symbols D. strings d. strings

Back to Board

25/02/2013

Intro to C++ 3 pts


What is the output of this code snippet? int sum=22; sum=sum+2; cout<<sum++; cout<<sum;

2425

Back to Board

Intro to C++ 4 pts


What is the output of this code snippet?
double average; int grade1=87; int grade2=94; //cout<<"Theaverageis"<<(grade+grade2)/2.0<<endl; cout<<"Theaverageis" <<average<<endl;

Unpredictable result Back to Board

25/02/2013

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?

A conditional expression is a Boolean expression that evaluates to true or false Relational operators and logical operators are used to form conditional expressions.

Back to Board

25/02/2013

Selection Control Structures 2 pts


Which of the following is the correct syntax for an if-else statement?
A. if (x<10){size="Small";} else (x<20){size="Medium";} B. if (x<10);{size="Small";} else (x<20){size="Medium";} C. if (x<10){size="Small";} else {size="Medium";} D. if {size="Small";} else (x<20){size="Medium";} C

Back to Board

Selection Control Structures 3 pts

DAILY DOUBLE!!!

25/02/2013

Selection Control Structures 4 pts


What is the problem with the following if statement? double count=15.0; if (count/3.0) { cout<<"Thevalueofcountis" << count<<endl; }

The condition does not evaluate to a Boolean value Back to Board

Selection Control Structures 5 pts


When an if statement is nested inside another if statement, it creates the possibility of

The dangling else

Back to Board

25/02/2013

Repetition Control Structures 1 pt


Which of the loops we studied executes the statements inside the loop before checking the condition?

do-while

Back to Board

Repetition Control Structures 2 pts


Which common error is present in the code below, which is intended to calculate the average 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

10

25/02/2013

Repetition Control Structures 3 pts


How many times will the following loop run?
int i=0; while (i<9) { cout<<i<<endl; i++; }

9 Back to Board

Repetition Control Structures 4 pts


What changes do you need to make in the following code snippet to display "Let us C" exactly 10 times? int i=0; while (i<=10) { cout<<"LetusC" <<endl; i++; } int i = 1; Back to Board

11

25/02/2013

Repetition Control Structures 5 pts


How many times is the text "Let us C" printed if the code snippet given below is run?
int i=0; do { cout<<"LetusC" <<endl; i++; if (i%2==0) { i=11; } }while (i<=10);

2 times Back to Board

Word Puzzle 1 pt
A special computer program that translates higher-level programs into machine instructions for a particular process ________ Compiler

Back to Board

12

25/02/2013

Word Puzzle 2 pt
The _____________ combines machine code with library code into an executable program ______

Linker

Back to Board

Word Puzzle 3 pt
Binary numbers can be stored in memory as a sequence of bits, called a ____________. ____

Word Examples: 16-bit, 32-bit, and 64-bit Back to Board

13

25/02/2013

Word Puzzle 4 pt

DAILY DOUBLE!!!

Word Puzzle 5 pt
The ________ operator is a unary operator that requests that the value of the operands be changed to a new type for the next computation. ____

cast Back to Board

14

25/02/2013

Selection Control Structures 3 pts


What can be done to improve the following code fragment? int cost=0;
int counter=0; while (counter<10000) { if ((counter%10)==0) { cout<<"Counterisdivisiblebyten:" <<counter<<endl; counter++; } else { cout<<"Counterisnotdivisiblebyten:" <<counter<<endl; counter++; } }

Move the duplicated code outside of the if statement Back to Board

Word Puzzle 8 pt
A ____________ operator is used to increment a variable by 1, then use the new value of variable in the expression in which the variable resides. ____________

preincrement

Back to Board

15

Potrebbero piacerti anche