DOC PREVIEW
UD CISC 181 - Clicker Questions

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CISC181 Introduction to Computer Science Dr. McCoy Lecture 7 Clicker Questions September 22, 2009Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 111CISC181 Introduction to Computer ScienceDr. McCoyLecture 7Clicker QuestionsSeptember 22, 2009Consider the loop:for ( int x = 1; x < 5; increment ) cout << x + 1 << endl;If the last value printed is 5, which of the following might have been used for increment?(a) x++(b) x += 1(c) ++x(d) Any of the above2Which of the following for headers is not valid?(a) for( int i = 0; i < 10; i++)(b) int i = 1; for( ; i < 10; i++ )(c) for( int i = 0, int j = 5; ; i++)(d) for( int i = 0; i < 10; )3In a switch structure(a) a break is required after each case(b) multiple actions do not need to be enclosed in braces(c) a default case is required(d) a break is required after the default case4The following program segment willint counter = 1;do { cout << counter << “ “;} while ( ++counter <= 10 );(a) print the numbers 1 through 11(b) print the numbers 1 through 10(c) print the numbers 1 through 9(d) cause a syntax error5In C++, the condition 4 > y > 1(a) evaluates correctly and could be replaced by ( 4 > y && y > 1 )(b) does not evaluate correctly and should be replaced by ( 4 > y && y > 1 )(c) evaluates correctly and could not be replaced by ( 4 > y && y > 1 )(d) does not evaluate correctly and should not be replaced by ( 4 > y && y > 1 )6Consider the following code, assuming that x is an integer variable with an initial value of 12: if( x = 6 ) cout << x;What is the output?(a) 6(b) 12(c) nothing(d) a syntax error is produced7All of the following are true of functions except:(a) they define specific tasks that can be used at many points in a program(b) a function call must specify the name and arguments of the function(c) the definition of a function usually is visible to other functions(d) the implementation of a function is hidden from the caller8A valid reason for building programs out of functions is(a) that the divide-and-conquer approach facilitates program construction(b) that pre-existing functions can be used to create new programs(c) the avoidance of code repetition within a program(d) all of the above9The function prototype double mySqrt( int x );(a) declares a function called mySqrt which takes an integer as an argument and returns a double(b) defines a function called mySqrt which takes an argument of type x and returns a double(c) declares a function called mySqrt which takes a double as an argument and returns an integer10Which of the following will not produce a syntax error?(a) omitting a return type from a function definition(b) returning a value from a function declared as void(c) declaring a function parameter again inside a function(d) using the same names for arguments passed to a function and the corresponding parameters in the function


View Full Document
Download Clicker Questions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Clicker Questions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Clicker Questions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?