qz7_ver3_sol

# qz7_ver3_sol - UCR CS010 Winter 2004 Introduction to...

This preview shows pages 1–2. Sign up to view the full content.

UCR CS010: Winter 2004 Introduction to Computer Science I Kris Miller Quiz 7: Lecture Sections 003 1. What is the value of the following Boolean expression if limit = 10 and cnt = 0? (limit < 20) || ((limit / cnt) > 10) a. true b. false c. 0 d. run-time error (division by zero) 2. What is the value of the following Boolean expression if limit = 10 and cnt = 0? (limit < 20) && ((limit / cnt) > 10) a. true b. false c. 0 d. run-time error (division by zero) 3. Given the following definition of the function notValidEntry, what will the code fragment output if the user enters an R? bool notValidEntry(char character) { return (character != ‘P’ & character != ‘R’ && character != ‘S’); } // begin code fragment char choice; cout << “Enter your choice: (P = paper, R = rock, S = scissors): ”; cin >> choice; if ( notValidEntry(choice) ) { cout << “\nYou chose “ << choice << endl; } a. Enter your choice: (P = paper, R = Rock, S = Scissors): R b. Enter your choice: (P = paper, R = Rock, S = Scissors): R

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 04/02/2012.

### Page1 / 3

qz7_ver3_sol - UCR CS010 Winter 2004 Introduction to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online