

Computer Science I Exam Bank
Course Introduction
Computer Science I is an introductory course that provides students with a foundational understanding of computer science principles and programming techniques. The course covers basic problem-solving strategies, algorithm development, and essential programming concepts using a high-level language such as Python or Java. Topics include variables, control structures, data types, functions, arrays or lists, and basic input/output operations. The course emphasizes logical thinking and systematic debugging as students learn to design, write, and test simple programs. No prior programming experience is required, making this course suitable for beginners seeking to develop computational problem-solving skills and a solid groundwork for further study in computer science.
Recommended Textbook
C++ Programming From Problem Analysis to Program Design 6th Edition by
Available Study Resources on Quizplus
18 Chapters
899 Verified Questions
899 Flashcards
Source URL: https://quizplus.com/study-set/1103

Page 2
D.S. Malik
Chapter 1: An Overview of Computers and Programming Languages
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/128446
Sample Questions
Q1) The programming language C++ was designed by Bjarne Stroustrup at Bell Laboratories in the early ____.
A) 1960s
B) 1970s
C) 1980s
D) 1990s
Answer: C
Q2) The structured design approach is also known as ____________________.
Answer: modular programming
top-down design
top down design
top-down
top down
bottom-up design
bottom up design
bottom-up
bottom up
stepwise refinement
Q3) The ASCII data set consists of ____________________ characters.
Answer: 128

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

Chapter 2: Basic Elements of C
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21709
Sample Questions
Q1) A(n) ____________________ is a sequence of zero or more characters.
Answer: string
Q2) The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.
A) semantic
B) logical
C) syntax
D) grammatical
Answer: C
Q3) ____________________ can be used to identify the authors of the program, give the date when the program is written or modified, give a brief explanation of the program, and explain the meaning of key statements in a program.
Answer: Comments
comments
Q4) The ____________________ type is C++ 's method for allowing programmers to create their own simple data types.
Answer: enumeration
Q5) The maximum number of significant digits is called the ____________________.
Answer: precision
To view all questions and flashcards with answers, click on the resource link above. Page 4

Chapter 3: Inputoutput
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21710
Sample Questions
Q1) Suppose that outFile is an ofstream variable and output is to be stored in the file outputData.out. Which of the following statements opens the file outputData.out and associates outFile to the output file?
A) outFile("outputData.out");
B) outFile.open("outputData.out");
C) open(outFile,"outputData.out");
D) open.outFile("outputData.out");
Answer: B
Q2) Suppose that x and y are int variables, z is a double variable, and the input is: 28 32.6 12
Choose the values of x, y, and z after the following statement executes:
Cin >> x >> y >> z;
A) x = 28, y = 32, z = 0.6
B) x = 28, y = 32, z = 12.0
C) x = 28, y = 12, z = 32.6
D) x = 28, y = 12, z = 0.6
Answer: A
Q3) cin is called a(n) ____________________ object. Answer: istream
To view all questions and flashcards with answers, click on the resource link above.
Page 5

Chapter 4: Control Structures I Selection
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21711
Sample Questions
Q1) Every else must be paired with a(n) ____________________.
Q2) What is the output of the following code? if (6 > 8)
{
\(\quad\)cout << " ** " << endl ; \(\quad\)cout << "****" << endl; }
else if (9 == 4)
\(\quad\)cout << "***" << endl; else
\(\quad\)cout << "*" << endl; A) *
B) ** C) *** D) ****
Q3) A ____________________ operator allows you to make comparisions in a program.
Q4) Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true. A)True B)False
To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Control Structures II Repetition
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21712
Sample Questions
Q1) In a(n) "____________________" problem, either the loop executes one too many or one too few times.
Q2) What is the output of the following C++ code? num = 100; while (num <= 150) \(\quad\)num = num + 5; cout << num << endl;
A) 150
B) 155
C) 160
D) 165
Q3) The following while loop terminates when j > 20. j = 0; while (j < 20) j++;
A)True
B)False
Q4) In the case of the sentinel-controlled while loop, the first item is read before the while loop is entered.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: User-Defined Functions
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21713
Sample Questions
Q1) To use the predefined function tolower, the program must include the header file
A) <cctype> B) <iostream> C) <cmath> D) <cstdlib>
Q2) Stream variables (for example, ifstream and ofstream) should be passed by ____________________ to a function.
Q3) Assume the following. static_cast<int>('a') = 97
Static_cast<int>('A') = 65
The output of the statement: Cout << static_cast<int>(tolower('B')) << endl; is ____.
A) 65
B) 67
C) 96
D) 98
Q4) A function ____________________ is a function that is not fully coded.
Q5) A(n) ____________________ parameter is a formal parameter that receives the location (memory address) of the corresponding actual parameter.
To view all questions and flashcards with answers, click on the resource link above. Page 8
Chapter 7: User-Defined
Simple Data Types, Namespaces, and the String Type
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21714
Sample Questions
Q1) The general syntax for accessing a namespace member is: namespace_name->identifier.
A)True
B)False
Q2) An anonymous type can be passed as a parameter to a function.
A)True
B)False
Q3) Suppose str = "xyzw";. After the statement str[2] = 'Y'; The value of str is "____".
A) xyzw
B) xYzw
C) xyYw
D) xzYw
Q4) Suppose str = "ABCDEFGHI". The output of the statement cout << str.length() << endl; Is ____.
A) 7
B) 8
C) 9
D) 10

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

Chapter 8: Arrays and Strings
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21715
Sample Questions
Q1) Two (or more) arrays are called ____________________ if their corresponding components hold related information.
Q2) Suppose that list is an array of 10 components of type int. Which of the following codes correctly outputs all the elements of list?
A) for (int j = 1; j < 10; j++)
cout << list[j] << " "; cout << endl;
B) for (int j = 0; j <= 9; j++)
cout << list[j] << " ";
cout << endl;
C) for (int j = 1; j < 11; j++)
cout << list[j] << " "; cout << endl;
D) for (int j = 1; j <= 10; j++)
cout << list[j] << " "; cout << endl;
Q3) For a list of length n, the ____________________ sort makes exactly (n(n - 1))/2 key comparisons and 3(n-1) item assignments.
Q4) The statement strlen("Marylin Stewart"); returns ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 10

Chapter 9: Records Structs
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21716
Sample Questions
Q1) The syntax for accessing a struct member is structVariableName____.
A) .memberName
B) *memberName
C) [memberName]
D) $memberName
Q2) Consider the following statements: struct rectangleData {
\(\quad\)double length; \(\quad\)double width; \(\quad\)double area; \(\quad\)double perimeter; };
rectangleData bigRect;
Which of the following statements is valid in C++?
A) cin >> bigRect;
B) cin >> bigRect.length;
C) perimeter = 2 * (length + width);
D) area = length * width;
Q3) Consider the accompanying struct definition in Figure 1. The statement that initializes the member firstName to Melissa is ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Classes and Data Abstraction
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/21717
Sample Questions
Q1) In C++, class is a reserved word and it defines only a data type.
A)True
B)False
Q2) In C++, the ____ is an operator called the member access operator.
A) .
B) ,
C) ::
D) #
Q3) In C++, you can pass a variable by reference and still prevent the function from changing its value by using the keyword ____ in the formal parameter declaration.
A) automatic
B) private
C) static
D) const
Q4) If an object is created in a user program, then the object can access both the public and private members of the class.
A)True
B)False
Q5) The header file is also known as the ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Inheritance and Composition
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21718
Sample Questions
Q1) In protected inheritance, public and protected members of the base class become the protected members of the derived class.
A)True
B)False
Q2) C++ provides ____ functions as a means to implement polymorphism in an inheritance hierarchy, which allows the run-time selection of appropriate member functions.
A) redefined
B) overridden
C) virtual
D) overloaded
Q3) If inheritance is private, all members of the base class, including private members, become private members of the derived class.
A)True
B)False
Q4) If inheritance is public, all protected members of the base class are ____________________ members of the derived class.
Q5) In ____________________ polymorphism, the (data) type is left unspecified and then later instantiated.
To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Pointers, Classes, Virtual Functions, and
Abstract Classes
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21719
Sample Questions
Q1) The ____________________ of a base class automatically makes the destructor of a derived class virtual.
Q2) If p is a pointer variable, the statement p = p + 1; is valid in C++.
A)True
B)False
Q3) Which of the following arithmetic operations is allowed on pointer variables?
A) Increment
B) Modulus
C) Multiplication
D) Division
Q4) The code int *p; declares p to be a(n) ____ variable.
A) new
B) num
C) pointer
D) address
Q5) Once a class contains one or more pure virtual functions, then that class is called a(n) ____________________ class.
Q6) In C++, the dot operator has a lower precedence than the dereferencing operator.
A)True
B)False Page 14
To view all questions and flashcards with answers, click on the resource link above.
Page 15

Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21720
Sample Questions
Q1) A conversion constructor is a(n) ____________________-parameter function.
Q2) The general syntax to overload the stream extraction operator >> for a class is ____.
A) istream& operator>>(istream&, className&);
B) const istream& operator>>(istream&, className&);
C) friend operator>>(istream&, className&);
D) friend istream& operator>>(istream&, className&);
Q3) When the post-increment operator is overloaded as a nonmember function of the class, the operator function has ____ parameter(s).
A) no
B) one
C) two
D) three
Q4) To overload the pre-increment (++) operator for a class, if the operator function is a member of that class, it must have ____ parameter(s).
A) no
B) one
C) two
D) three
To view all questions and flashcards with answers, click on the resource link above. Page 16

Chapter 14: Exception Handling
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21721
Sample Questions
Q1) The statements that may generate an exception are placed in a ____ block.
A) throw
B) finally
C) try
D) catch
Q2) If the operator new cannot allocate memory space, this operator throws a(n) ____________________ exception.
Q3) If a length greater than the maximum allowed for a string object is used, the class ____________________ deals with the error that occurs.
Q4) C++ provides all the exception classes you will ever need.
A)True
B)False
Q5) In C++, any class can be considered an exception class.
A)True
B)False
Q6) When an exception occurs in a program, the programmer usually has three choices: ____________________, include code in the program to recover from the exception, or log the error and continue.
Q7) In C++, throw is a(n) ____________________ word.
To view all questions and flashcards with answers, click on the resource link above. Page 17

Chapter 15: Recursion
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21722
Sample Questions
Q1) With recursion, the base case must eventually be reduced to a general case.
A)True
B)False
Q2) Consider the following code. int fact(int num) { if (num == 0)
\(\quad\)return 1; else
\(\quad\)return num * fact(num - 1); }
The function fact is an example of a(n) ____________________ recursive function.
Q3) If a function A calls a function B and function B calls function A, then function A is ____________________ recursive.
Q4) A function is called ____ if it calls itself.
A) directly iterative
B) indirectly iterative
C) directly recursive
D) indirectly recursive
Q5) The collating sequence of A in the ASCII character set is ____________________.
Page 18
To view all questions and flashcards with answers, click on the resource link above.

Chapter 16: Searching, Sorting and the Vector Type
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21723
Sample Questions
Q1) With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.
A) one
B) two
C) n-2
D) n
Q2) The type vector provides the function ____________________, which returns the first element in the vector object.
Q3) Consider the following list. int list[] = {4, 8, 19, 25, 34, 39, 45, 48, 66, 75, 89, 95} When performing a binary search for 75, after the first comparison, the search is restricted to ____.
A) list[0]...list[6]
B) list[0]...list[7]
C) list[5]...list[11]
D) list[6]...list[11]
Q4) A sequential search is much faster than a binary search.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 19

Chapter 17: Linked Lists
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21724
Sample Questions
Q1) Because each node of a linked list has two components, we need to declare each node as a(n) ____.
A) reference and string
B) int and object
C) index and element
D) class or struct
Q2) In a linked list, the order of the nodes is determined by the address, called the ____, stored in each node.
A) head
B) tail
C) link
D) first
Q3) Which of the following is a basic operation on singly linked lists?
A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is full.
D) Make a copy of the linked list.
Q4) If a formal parameter is a value parameter, the ____________________ constructor provides the formal parameter with its own copy of the data.
To view all questions and flashcards with answers, click on the resource link above. Page 20

Chapter 18: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21725
Sample Questions
Q1) When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.
Q2) The default constructor for the linked implementation of a stack initializes the stack to an empty state when a stack object is declared. A)True B)False
Q3) The postfix expression 3 5 + 2 ; 6 - = will generate an error, because it ____.
A) contains an illegal operator
B) does not have enough operands
C) has too many operands
D) has too many operators
Q4) Postfix notation requires the use of parentheses to enforce operator precedence. A)True B)False
Q5) In a queuing system, every customer has a customer number, arrival time, ____________________ time, transaction time, and departure time.
Q6) The expression a + b is the same in both infix notation and postfix notation. A)True B)False
Page 21
To view all questions and flashcards with answers, click on the resource link above.