Starting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 Key

Similar documents
Chapter Two MULTIPLE CHOICE

LECTURE 02 INTRODUCTION TO C++

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

CHAPTER 3 BASIC INSTRUCTION OF C++

Chapter 2: Introduction to C++

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

The C++ Language. Arizona State University 1

Lab # 02. Basic Elements of C++ _ Part1

2 nd Week Lecture Notes

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Understanding main() function Input/Output Streams

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc.

Objectives. In this chapter, you will:

1. In C++, reserved words are the same as predefined identifiers. a. True

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad

CPE Summer 2015 Exam I (150 pts) June 18, 2015

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

Chapter 2 Basic Elements of C++

Object-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++

Chapter 1 INTRODUCTION

BITG 1233: Introduction to C++

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

CS242 COMPUTER PROGRAMMING

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

C++ Programming: From Problem Analysis to Program Design, Third Edition

Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

Chapter 1 Introduction to Computers and C++ Programming

Your first C++ program

CSc Introduction to Computing

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Lecture 3 Tao Wang 1

Homework #3 CS2255 Fall 2012

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

Computer Programming : C++

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Chapter 2. C++ Basics

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Name Section: M/W or T/TH. True or False (14 Points)

Chapter 4 - Notes Control Structures I (Selection)

Review. Relational Operators. The if Statement. CS 151 Review #4

Lecture 2 Tao Wang 1

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1

4. Structure of a C++ program

Full file at C How to Program, 6/e Multiple Choice Test Bank

Programming with C++ as a Second Language

Introduction to C++ Programming. Adhi Harmoko S, M.Komp

Text File I/O. #include <iostream> #include <fstream> using namespace std; int main() {

Name SECTION: 12:45 2:20. True or False (12 Points)

Chapter Overview. C++ Basics. Variables and Assignments. Variables and Assignments. Keywords. Identifiers. 2.1 Variables and Assignments

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

A First Program - Greeting.cpp

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Integer Data Types. Data Type. Data Types. int, short int, long int

BTE2313. Chapter 2: Introduction to C++ Programming

Input And Output of C++

Chapter 2: Overview of C++

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Your First C++ Program. September 1, 2010

CSI33 Data Structures

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Example of Objective Test Questions for Test 4

Creating a C++ Program

Fundamentals of Programming CS-110. Lecture 2

Increment and the While. Class 15

5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (!

FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each):

Introduction to Programming EC-105. Lecture 2

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++

Introduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2

Unit 3. Constants and Expressions

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

4. Inputting data or messages to a function is called passing data to the function.

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++

CS2255 HOMEWORK #1 Fall 2012

Exercise: Using Numbers

Exam 3 Chapters 7 & 9

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

download instant at Introduction to C++

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

CPE 112 Spring 2015 Exam III (100 pts) April 8, True or False (12 Points)

C++ Final Exam 2017/2018

Programming. C++ Basics

CS 115 Exam 3, Spring 2010

Review for COSC 120 8/31/2017. Review for COSC 120 Computer Systems. Review for COSC 120 Computer Structure

DECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA.

Transcription:

Starting Out with C++ Early Objects 9th Edition Gaddis TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/starting-c-early-objects-9thedition-gaddis-test-bank/ Starting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 Key 1) In a C++ program, two slash marks ( // ) indicate the beginning of A) a block of code. B) a comment. C) a variable definition. D) a program. E) none of the above. 2) #include <iostream> is an example of a(n) A) comment. B) I/O statement. C) preprocessor directive. D) stream directive. E) compiler option. Answer: C 3) True/False: C++ is a case-sensitive language. Answer: TRUE 4) The is used to display information on the computer's screen. A) < symbol B) cin object C) cout object D) print object E) output object Answer: C 5) Which of the following will cause the next output to begin on a new line? A) cout << endl; B) cout << "endl"; C) cout << "/n"; E) A and C, but not B 6) The directive causes the contents of another file to be inserted into a program. A) #getfile B) #library

C) #insert D) #include E) None of the above Answer: D 7) True/False: A variable of the char data type can hold a set of characters like "January". Answer: FALSE

8) You must have a(n) for every variable you include in a program. A) purpose B) definition C) comment D) numeric value E) output statement 9) Which of the following is/are valid C++ identifiers? A) June-2010 B) June.2010 C) June_2010 D) 2010June E) Both C and D. Answer: C 10) are data items whose values cannot change while the program is running. A) Literals B) Variables C) Fixed data D) Integers E) None of the above 11) True/False: The following two C++ statements perform the same operation. wages = regpay + overtime; regpay + overtime = wages; Answer: FALSE 12) Which of the following definitions will allow the variable total to hold floating-point values? A) float total; B) double total; C) auto total = 0.0; E) A and B, but not C Answer: D 13) What value will be assigned to the variable number by the following statement? int number = 7.8; A) 7 B) 8 C) 7.8 D) None of the above. E) It's unpredictable. That's the problem. 14) If number is an int variable, both of the following statements will print out its value: cout << number; cout << "number"; Answer: FALSE

15) What value will be assigned to the variable number by the following statement? int number = 7.8; A) 7 B) 8 C) 7.8 D) None of the above. E) It's unpredictable. That's the problem. 16) A C++ character literal is enclosed in quotation marks, whereas a string literal is enclosed in quotation marks. A) double, single B) triple, double C) open, closed D) single, double E) no, some Answer: D 17) C++ automatically places at the end of a string literal. A) a semicolon B) quotation marks C) the null terminator D) a newline escape sequence E) a blank Answer: C 18) The bool data type A) can be used to store a single character. B) has only two values: true and false. C) is used to store extra-large numbers. D) is used to represent numbers in E notation. E) does none of the above. 19) The expression 5 / 2 evaluates to B) 2 C) 2.5 D) 5.2 E) 10 20) The expression 5 % 2 evaluates to B) 2 C) 2.5 D) 5.2 E) 10

Chapter 2 Test 2 Key 1) Every C++ program must have A) comments. B) variables. C) literals. D) a function called main.. E) all of the above. Answer: D 2) A is used to mark the end of a complete C++ programming statement. A) comment B) period C) semicolon D) closing brace E) new line Answer: C 3) Which of the following will cause the next output to begin on a new line? A) cout << endl; B) cout << "endl"; C) cout << "/n"; E) A and C, but not B 4) In programming terms, a group of characters inside a set of double quotation marks (" ") is called A) a character literal. B) a string literal. C) a character set. D) none of the above. E) any of the above. 5) True/False: The following two statements could be used interchangeably in a C++ program. // Program Payroll /* Program Payroll */ Answer: TRUE 6) A variable must be defined A) in every program. B) and initialized at the same time. C) in order to perform output. D) before it can be used. E) in all of the above cases. Answer: D

7) True/False: The following statements both declare the variable num to be an integer. int num; INT num; Answer: FALSE 8) Which of the following definitions will allow the variable average to hold floating-point values? A) float average; B) double average; C) auto average = 0.0; E) A and B, but not C Answer: D 9) What literal(s) appear in the following C++ statement? int number = 4 + 8; A) number B) 4 C) 8 D) 12 E) both B and C Answer: E 10) Which of the following is/are valid C++ identifiers? A) department_9 B) averylongvariablename C) last-name. E) Both A and B, but not C. Answer: E 11) Which of the following keywords is/are the names of C++ data types? A) short B) long C) double D) bool E) All of the above Answer: E 12) must be included in a program in order to use the cout object. A) Opening and closing braces B) The iostream header file C) A cout declaration D) Strings E) None of the above 13) True/False: The following is a legal C++ statement to define and initialize a variable. char firstname = "Jack"; Answer: FALSE

14) A variable can hold only one of two values: true or false. A) binary B) single precision C) T/F D) char E) bool Answer: E 15) True/False: If a variable is defined as int sum; it may be written in the program code as sum or Sum, but not SUM. Answer: FALSE 16) An operation that copies a value into a variable is called a(n) operation. A) assignment B) equals C) copy D) declaration E) cout 17) What value will be assigned to the variable number by the following statement? int number = 3.75; A) 3 B) 4 C) 3.75 D) None of the above. E) It's unpredictable. That's the problem. 18) True/False: The following two statements both assign the value 5 to the variable dept. 5 = dept; dept = 5; Answer: FALSE 19) The expression 7 % 2 evaluates to B) 3 C) 3.5 D) 7.2 E) 14 20) The expression 7 / 2 evaluates to B) 3 C) 3.5 D) 7.2 E) 14

Starting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 1) In a C++ program, two slash marks ( // ) indicate the beginning of A) a block of code. B) a comment. C) a variable definition. D) a program. E) none of the above. 2) #include <iostream> is an example of a(n) A) comment. B) I/O statement. C) preprocessor directive. D) stream directive. E) compiler option. 3) True/False: C++ is a case-sensitive language. 4) The is used to display information on the computer's screen. A) < symbol B) cin object C) cout object D) print object E) output object 5) Which of the following will cause the next output to begin on a new line? A) cout << endl; B) cout << "endl"; C) cout << "/n"; E) A and C, but not B 6) The directive causes the contents of another file to be inserted into a program. A) #getfile B) #library C) #insert D) #include E) None of the above 7) True/False: A variable of the char data type can hold a set of characters like "January".

8) You must have a(n) for every variable you include in a program. A) purpose B) definition C) comment D) numeric value E) output statement 9) Which of the following is/are valid C++ identifiers? A) June-2010 B) June.2010 C) June_2010 D) 2010June E) Both C and D. 10) are data items whose values cannot change while the program is running. A) Literals B) Variables C) Fixed data D) Integers E) None of the above 11) True/False: The following two C++ statements perform the same operation. wages = regpay + overtime; regpay + overtime = wages; 12) Which of the following definitions will allow the variable total to hold floating-point values? A) float total; B) double total; C) auto total = 0.0; E) A and B, but not C 13) What value will be assigned to the variable number by the following statement? int number = 7.8; A) 7 B) 8 C) 7.8 D) None of the above. E) It's unpredictable. That's the problem. 14) If number is an int variable, both of the following statements will print out its value: cout << number; cout << "number";

15) What value will be assigned to the variable number by the following statement? int number = 7.8; A) 7 B) 8 C) 7.8 D) None of the above. E) It's unpredictable. That's the problem. 16) A C++ character literal is enclosed in quotation marks, whereas a string literal is enclosed in quotation marks. A) double, single B) triple, double C) open, closed D) single, double E) no, some 17) C++ automatically places at the end of a string literal. A) a semicolon B) quotation marks C) the null terminator D) a newline escape sequence E) a blank 18) The bool data type A) can be used to store a single character. B) has only two values: true and false. C) is used to store extra-large numbers. D) is used to represent numbers in E notation. E) does none of the above. 19) The expression 5 / 2 evaluates to B) 2 C) 2.5 D) 5.2 E) 10 20) The expression 5 % 2 evaluates to B) 2 C) 2.5 D) 5.2 E) 10

Chapter 2 Test 2 1) Every C++ program must have A) comments. B) variables. C) literals. D) a function called main.. E) all of the above. 2) A is used to mark the end of a complete C++ programming statement. A) comment B) period C) semicolon D) closing brace E) new line 3) Which of the following will cause the next output to begin on a new line? A) cout << endl; B) cout << "endl"; C) cout << "/n"; E) A and C, but not B 4) In programming terms, a group of characters inside a set of double quotation marks (" ") is called A) a character literal. B) a string literal. C) a character set. D) none of the above. E) any of the above. 5) True/False: The following two statements could be used interchangeably in a C++ program. // Program Payroll /* Program Payroll */ 6) A variable must be defined A) in every program. B) and initialized at the same time. C) in order to perform output. D) before it can be used. E) in all of the above cases.

7) True/False: The following statements both declare the variable num to be an integer. int num; INT num; 8) Which of the following definitions will allow the variable average to hold floating-point values? A) float average; B) double average; C) auto average = 0.0; E) A and B, but not C 9) What literal(s) appear in the following C++ statement? int number = 4 + 8; A) number B) 4 C) 8 D) 12 E) both B and C 10) Which of the following is/are valid C++ identifiers? A) department_9 B) averylongvariablename C) last-name. E) Both A and B, but not C. 11) Which of the following keywords is/are the names of C++ data types? A) short B) long C) double D) bool E) All of the above 12) must be included in a program in order to use the cout object. A) Opening and closing braces B) The iostream header file C) A cout declaration D) Strings E) None of the above 13) True/False: The following is a legal C++ statement to define and initialize a variable. char firstname = "Jack";

14) A variable can hold only one of two values: true or false. A) binary B) single precision C) T/F D) char E) bool 15) True/False: If a variable is defined as int sum; it may be written in the program code as sum or Sum, but not SUM. 16) An operation that copies a value into a variable is called a(n) operation. A) assignment B) equals C) copy D) declaration E) cout 17) What value will be assigned to the variable number by the following statement? int number = 3.75; A) 3 B) 4 C) 3.75 D) None of the above. E) It's unpredictable. That's the problem. 18) True/False: The following two statements both assign the value 5 to the variable dept. 5 = dept; dept = 5; 19) The expression 7 % 2 evaluates to B) 3 C) 3.5 D) 7.2 E) 14 20) The expression 7 / 2 evaluates to B) 3 C) 3.5 D) 7.2 E) 14

Starting Out with C++ Early Objects 9th Edition Gaddis TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/starting-c-early-objects-9thedition-gaddis-test-bank/ starting out with c++ early objects 9th edition pdf starting out with c++ early objects 8th edition pdf starting out with c++ from control structures through objects 9th edition pdf starting out with c++ 9th edition pdf starting out with c++: early objects starting out with c++ early objects 8th edition pdf free download starting out w/c++,early objects pdf starting out with c++ 7th edition