Skip to main content

Computer Science I Textbook Exam Questions - 949 Verified Questions

Page 1


Computer Science I

Textbook Exam Questions

Course Introduction

Computer Science I is an introductory course designed to acquaint students with foundational principles of computer science and develop fundamental programming skills. The course covers topics such as algorithms, problem-solving techniques, basic programming concepts (variables, control structures, functions, and data structures), and software development practices. Through hands-on exercises and projects, students learn to write, test, and debug simple programs typically using a high-level programming language such as Python or Java while gaining an understanding of computational thinking and the role of ethics in computing. This course serves as a stepping stone for more advanced study in computer science.

Recommended Textbook

Starting Out with C++ from Control Structures to Objects 9th Edition by Tony Gaddis

Available Study Resources on Quizplus

21 Chapters

949 Verified Questions

949 Flashcards

Source URL: https://quizplus.com/study-set/1368

2

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27271

Sample Questions

Q1) Which step uncovers any syntax errors in your program?

A) editing

B) compiling

C) linking

D) executing

E) None of these

Answer: B

Q2) Mistakes that cause a running program to produce incorrect results are called:

A) syntax errors

B) logic errors

C) compiler errors

D) linker errors

E) None of these Answer: B

Q3) In C++, key words are written in all lowercase letters.

A)True

B)False

Answer: True

To view all questions and flashcards with answers, click on the resource link above. Page 3

Chapter 2: Introduction to C

Available Study Resources on Quizplus for this Chatper

62 Verified Questions

62 Flashcards

Source URL: https://quizplus.com/quiz/27272

Sample Questions

Q1) Escape sequences are always stored internally as a single character.

A)True

B)False

Answer: True

Q2) Character constants in C++ are always enclosed in

A) brackets ( < > )

B) braces ( { } )

C) single quotation marks ( ' ' )

D) pound sign and semicolon ( # ; )

E) Any of these

Answer: C

Q3) You must have a _____________ for every variable you intend to use in a program.

A) purpose

B) variable definition

C) memory space

D) literal value

E) None of these

Answer: B

To view all questions and flashcards with answers, click on the resource link above.

Page 4

Chapter 3: Expressions and Interactivity

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

Source URL: https://quizplus.com/quiz/27273

Sample Questions

Q1) Which of the following statements will read an entire line of input into the string object, address?

A) cin << address;

B) cin address;

C) cin.get(address);

D) getline(cin, address);

E) cin.get(length >> width >> height);

Answer: D

Q2) __________ reads a line of input, including leading and embedded spaces, and stores it in a string object.

A) cin.get

B) getline

C) cin.getline

D) get

E) None of these

Answer: B

Q3) The fixed manipulator causes a number to be displayed in scientific notation.

A)True

B)False

Answer: False

To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Making Decisions

Available Study Resources on Quizplus for this Chatper

51 Verified Questions

51 Flashcards

Source URL: https://quizplus.com/quiz/27274

Sample Questions

Q1) This operator represents the logical OR:

A) --

B) ||

C) &&

D) #

E) None of these

Q2) What is the value of donuts after the following statement executes? int donuts = 10; if (donuts = 1)

\(\quad\)donuts = 0; else

\(\quad\)donuts += 2;

A) 12

B) 10

C) 0

D) 1

E) None of these

Q3) The conditional operator takes two operands.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Loops and Files

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/27275

Sample Questions

Q1) A for statement contains three expressions:

Initialization, test, and

A) update

B) reversal

C) null

D) validation

E) None of these

Q2) A while loop's body can contain multiple statements, as long as they are enclosed in braces.

A)True

B)False

Q3) To write read data from a file, you define an object of the __________ data type.

A) inputFile

B) ifstream

C) fstream

D) ofstream

Q4) An output file is a file that data is written to.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: Functions

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

Source URL: https://quizplus.com/quiz/27276

Sample Questions

Q1) Local variables are initialized to zero by default.

A)True

B)False

Q2) If a function does not have a prototype, default arguments may be specified in the

A) function call

B) function header

C) execution

D) return type

E) None of these

Q3) __________ functions may have the same name as long as their parameter lists are different.

A) Only two

B) Two or more

C) No

D) Un-prototyped

E) None of these

Q4) You must always furnish an argument with a function call.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Arrays and Vectors

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

Source URL: https://quizplus.com/quiz/27277

Sample Questions

Q1) An array with no elements is

A) legal in C++

B) illegal in C++

C) automatically furnished with one element whose value is set to zero

D) automatically furnished with one element, the null terminator

E) None of these

Q2) This following statement shows an example of ___________. int grades][ ] = {100, 90, 99, 80};

A) default arguments

B) an illegal array declaration

C) an illegal array initialization

D) implicit array sizing

E) None of these

Q3) The range-based for loop in C++11 is designed to work with a built-in variable known as

A) the counter

B) the i variable

C) an iterator

D) the range variable

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Searching and Sorting Arrays

Available Study Resources on Quizplus for this Chatper

30 Verified Questions

30 Flashcards

Source URL: https://quizplus.com/quiz/27278

Sample Questions

Q1) A(n) __________ search uses a loop to sequentially step through an array.

A) binary

B) unary

C) linear

D) relative

E) None of these

Q2) Using a linear search to find a value that is stored in the last element of an array that contains 20,000 elements, __________ elements must be compared.

A) 20,000

B) only the first two

C) only half

D) 2,000

E) None of these

Q3) A linear search can only be implemented with integer values.

A)True

B)False

Q4) Before you can perform a selection sort, the data must be stored in ascending order.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 10

Chapter 9: Pointers

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27279

Sample Questions

Q1) The following statement __________ cin >> *num3;

A) stores the keyboard input in the variable num3

B) stores the keyboard input into the pointer num3

C) is illegal in C++

D) stores the keyboard input into the variable pointed to by num3

E) None of these

Q2) Use the delete operator only on pointers that were

A) never used

B) not correctly initialized

C) created with the new operator

D) dereferenced inappropriately

E) None of these

Q3) The weak_ptr can share ownership of a piece of dynamically allocated memory. A)True

B)False

Q4) In C++11, the nullptr keyword was introduced to represent the address 0.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

11

Chapter 10: Characters, C-Strings, and More About the String Class

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27280

Sample Questions

Q1) The __________ function will change a character argument from lowercase to uppercase.

A) isupper

B) toupper

C) tolarge

D) fromlower

E) None of these

Q2) To use the strlen function in a program you must include A) #include&lt;strlen&gt; B) #include&lt;iostring&gt; C) #include&lt;cstring&gt; D) #include&lt;stringlib&gt; E) None of these

Q3) The C++ library provides functions for converting a string representation of a number to a numeric data type and vice-versa.

A)True

B)False

Q4) The ftoa function converts a floating-point value to an ASCII value.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Structured Data

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

Source URL: https://quizplus.com/quiz/27281

Sample Questions

Q1) A structure pointer contains

A) the address of a structure variable

B) the dereferenced address of a structure tag

C) the name and address of the structure tag

D) the address of a structure tag

E) None of these

Q2) If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type.

A)True

B)False

Q3) After the following statement executes, what value will the MAPLE enumerator be stored as, in memory?

Enum Tree { OAK, MAPLE, PINE };

A) "MAPLE"

B) 2

C) 'M'

D) 1

E)1.0

To view all questions and flashcards with answers, click on the resource link above.

13

Chapter 12: Advanced File Operations

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

Source URL: https://quizplus.com/quiz/27282

Sample Questions

Q1) Which of the following data types can be used to create files and read information from them into memory?

A) ofstream

B) istream

C) ifstream

D) instream

E) None of these

Q2) Data stored __________ disappears once the program stops running or the computer is powered down.

A) on a CD

B) in RAM

C) on a flash drive

D) on the disk drive

E) None of these

Q3) All stream objects have __________ which indicate the position of the stream.

A) error state bits

B) condition statements

C) markers

D) intrinsic error messages

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 13: Introduction to Classes

Available Study Resources on Quizplus for this Chatper

54 Verified Questions

54 Flashcards

Source URL: https://quizplus.com/quiz/27283

Sample Questions

Q1) Which of the following is automatically called when an object is destroyed?

A) the constructor function

B) the specification deallocator

C) the destructor function

D) the destruction function

E) None of these

Q2) You must use the private access specification for all data members of a class.

A)True

B)False

Q3) Objects are created from abstract data types that encapsulate __________ and __________ together.

A) numbers, characters

B) data, functions

C) addresses, pointers

D) integers, floating-point numbers

E) None of these

Q4) In-place member initialization no longer is available in C++11.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 14: More About Classes

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

Source URL: https://quizplus.com/quiz/27284

Sample Questions

Q1) You may overload any C++ operator and you may use the operator function to define non-standard operations, such as @ or ^.

A)True

B)False

Q2) Which type of function is not a member of a class but has access to the private members of the class?

A) static

B) constructor

C) destructor

D) friend

E) None of these

Q3) Which of the following operators may be used to assign one object to another?

A) =

B) ==

C) <>

D) @

E) None of these

Q4) In C++ if you overload the < operator, you must also overload the > operator. A)True

B)False

Page 16

To view all questions and flashcards with answers, click on the resource link above.

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

Source URL: https://quizplus.com/quiz/27285

Sample Questions

Q1) Select all that apply. The base class access specification determines how __________ members in the base class may be accessed by derived classes.

A) private

B) public

C) constructed

D) protected

E) None of these

Q2) Which of the following is commonly used to extend a class or to give it additional capabilities?

A) inheritance

B) privacy

C) the constructor

D) the destructor

E) None of these

Q3) In C++11, if a derived class attempts to override a final member function, the compiler generates an error.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 17

Chapter 16: Exceptions and Templates

Available Study Resources on Quizplus for this Chatper

36 Verified Questions

36 Flashcards

Source URL: https://quizplus.com/quiz/27286

Sample Questions

Q1) Exceptions are used to signal errors or unexpected results that occur when a program is running.

A)True B)False

Q2) An actual instance of the function is created in memory when the compiler encounters

A) the template prefix

B) a call to the template function

C) a try block

D) a catch block

E) None of these

Q3) The line containing a throw statement is known as the throw point.

A)True B)False

Q4) A program may not contain both a "regular" version of a function and a template version of the function.

A)True B)False

To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 17: The Standard Template Library

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

Source URL: https://quizplus.com/quiz/27287

Sample Questions

Q1) An iterator of the iterator type that gives you read/write access to the element to which the iterator points is known as a(n)

A) immutable iterator

B) mutable iterator

C) auto iterator

D) range iterator

E) None of these

Q2) When an element is stored in a map, it is stored as an object of the __________ type.

A) map

B) key

C) pair

D) key_value

E) None of these

Q3) A vector is an associative container that works like an array but is dynamic in size.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

19

Chapter 18: Linked Lists

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

Source URL: https://quizplus.com/quiz/27288

Sample Questions

Q1) Select all that apply. A __________ list contains pointers to the nodes before it and after it.

A) multi linked

B) circular linked

C) singly linked

D) doubly linked

Q2) A list that contains pointers to the previous node, the next node, and a node in the third dimension is known as a triple linked list.

A)True

B)False

Q3) To insert a new node in ascending order into a list, the list must be

A) arranged in descending order

B) randomly ordered

C) empty

D) arranged in ascending order

E) None of these

Q4) Linked lists are less complex to code and manage than arrays.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 20

Chapter 19: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27289

Sample Questions

Q1) Select all that apply. A practical application of the stack data type in a computer system is

A) storage of local variables

B) tracking nested loops

C) tracking nested function calls

D) None of these

Q2) For a compiler that is older than C++11 it is necessary to put spaces between the angled brackets that appear next to each other when defining a stack.

A)True

B)False

Q3) The first item placed onto a stack is always the last item removed from the stack.

A)True

B)False

Q4) The pop function in the stack template of the STL does not retrieve the value from the top of the stack; it merely removes it.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

21

Chapter 20: Recursion

Available Study Resources on Quizplus for this Chatper

27 Verified Questions

27 Flashcards

Source URL: https://quizplus.com/quiz/27290

Sample Questions

Q1) Indirect recursion means that a function calls itself n number of times and then processing of the function starts from the first call.

A)True

B)False

Q2) A recursive function cannot call another function.

A)True

B)False

Q3) When function A calls function B which, in turn, calls function A, this is known as

A) direct recursion

B) indirect recursion

C) function swapping

D) perfect recursion

E) None of these

Q4) The programmer must ensure that a recursive function does not become

A) a static function

B) a virtual function

C) an endless loop

D) a dynamic function

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 22

Chapter 21: Binary Trees

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

Source URL: https://quizplus.com/quiz/27291

Sample Questions

Q1) To remove a node that has children, you must first remove the children.

A)True

B)False

Q2) Binary trees are commonly used to organize key values that index database records.

A)True

B)False

Q3) All node pointers that do not point to other nodes are set to

A) the root of the tree

B) a parent node

C) their leftmost child node

D) a null pointer

E) None of these

Q4) Select all that apply. Which of the following operations can be performed on a binary search tree?

A) moving

B) inserting

C) finding

D) placing

E) deleting

To view all questions and flashcards with answers, click on the resource link above. Page 23

Turn static files into dynamic content formats.

Create a flipbook