

Computer Science I Review
Questions
Course Introduction
Computer Science I introduces students to the fundamental concepts and principles of computer programming and problem-solving using a high-level programming language. The course covers topics such as variables, control structures, functions, arrays, and data types, providing a solid foundation in algorithm development and debugging techniques. Emphasis is placed on writing, testing, and analyzing code to solve computational problems, laying the groundwork for advanced study in computer science.
Recommended Textbook
C++ Programming From Problem Analysis to Program Design 6th Edition by D.S. Malik
Available Study Resources on Quizplus
18 Chapters
899 Verified Questions
899 Flashcards
Source URL: https://quizplus.com/study-set/1103

2

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 term GB refers to ____.
A) giant byte
B) gigabyte
C) group byte
D) great byte
Answer: B
Q2) Dividing a problem into smaller subproblems is called ____ design.
A) OOD
B) top-down refinement
C) structured
D) analog
Answer: C
Q3) The digit 0 or 1 is called a binary digit, or ____.
A) bit
B) bytecode
C) Unicode
D) hexcode
Answer: A
Q4) A sequence of 0s and 1s is sometimes referred to as ____________________ code.
Answer: binary
To view all questions and flashcards with answers, click on the resource link above. Page 3

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) ____________________ 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
Q2) Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____.
A) 1
B) 2
C) 3
D) 4
Answer: B
Q3) A comma is also called a statement terminator.
A)True
B)False
Answer: False
Q4) A(n) ____________________ is a memory location whose contents can be changed.
Answer: variable
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) On some compilers, the statements cin >> left; and cin >> right; might not work. In this case, you can use the statement ____________________ in place of cin >> left;.
Answer: cin.setf(ios::left);
Q2) What is the output of the following statements? cout << setfill('*'); Cout << "12345678901234567890" << endl Cout << setw(5) << "18" << setw(7) << "Happy" << setw(8) << "Sleepy" << endl;
A) 12345678901234567890
***18 Happy Sleepy
B) 12345678901234567890
***18**Happy**Sleepy
C) 12345678901234567890
***18**Happy Sleepy
D) 12345678901234567890
***18**Happy Sleepy**
Answer: B
Q3) C++ has a special name for the data types istream and ostream. They are called
Answer: classes
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) Consider the following statements. int score; string grade; if (score >= 65) grade = "pass"; else grade = "fail"; If score is equal to 75, the value of grade is "____________________".
Q2) The term ____________________ describes a process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.
Q3) The ____________________ of relational and logical operators is said to be from left to right.
Q4) The symbol > is a(n) ____________________ operator.
Q5) To output results correctly, the switch structure must include a(n) ____________________ statement after each cout statement, except the last cout statement.
Q6) Putting a semicolon after the parentheses following the expression in an if statement (that is, before the statement) is a(n) ____________________ error.
Page 6
To view all questions and flashcards with answers, click on the resource link above.

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) Assume all variables are properly declared. The output of the following C++ code is 2
3 4 5. n = 1; while (n < 5)
{ n++;
cout << n << " "; }
A)True
B)False
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 for loop body executes indefinitely if the loop condition is always
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) The statement: return 37, y, 2 * 3; returns the value ____.
A) 2
B) 3
C) y
D) 6
Q2) A variable listed in a header is known as a(n) ____ parameter.
A) actual
B) local
C) formal
D) function
Q3) Once you write and properly debug a function, you can use it in the program (or different programs) again and again without having to rewrite the same code repeatedly.
A)True
B)False
Q4) A(n) ____________________ parameter is a formal parameter that receives the location (memory address) of the corresponding actual parameter.
Q5) The program that tests a function is called a(n) ____________________ program.
Q6) In C++, :: is called the ____________________.
8
Q7) A function ____________________ is a function that is not fully coded.
To view all questions and flashcards with answers, click on the resource link above.
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) In July ____, ANSI/ISO Standard C++ was officially approved.
A) 1996
B) 1998
C) 1999
D) 2000
Q2) Considering the statement string str = "Gone with the wind";, the output of the statement cout << str.find("the") << endl; is ____.
A) 9
B) 10
C) 11
D) 12
Q3) Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str is "____________________".
Q4) An enumeration type can be passed as a parameter to a function only by value. A)True
B)False
Q5) In C++, [] is called the array subscript operator.
A)True
B)False

Page 9
Q6) The values in the domain of an enumeration type are called
To view all questions and flashcards with answers, click on the resource link above.
Page 10

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) Which of the following statements declares alpha to be an array of 25 components of the type int?
A) int alpha[25];
B) int array alpha[25];
C) int alpha[2][5];
D) int array alpha[25][25];
Q2) Assume you have the following declaration int beta[50];. Which of the following is a valid element of beta?
A) beta['2']
B) beta['50']
C) beta[0]
D) beta[50]
Q3) What is the value of alpha[2] after the following code executes? int alpha[5]; Int j;
For (j = 0; j < 5; j++)
Alpha[j] = 2 * j + 1;
A) 1
B) 4
C) 5
D) 6
To view all questions and flashcards with answers, click on the resource link above. Page 11

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) You can use an assignment statement to copy the contents of one struct into another struct of the same type.
A)True
B)False
Q2) Consider the following struct definition: struct rectangleData { \(\quad\)double length; \(\quad\)double width; \(\quad\)double area; \(\quad\)double perimeter; };
Which of the following variable declarations is correct?
A) rectangle rectangleData;
B) struct rectangleData();
C) rectangleData myRectangle;
D) rectangleData rectangle = new rectangleData();
Q3) The contents of a struct variable must be written one member at a time.
A)True
B)False
Q4) In C++, struct is a(n) ____________________ word.
Page 12
To view all questions and flashcards with answers, click on the resource link above.

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) If the heading of a member function of a class ends with the word const, then the function member cannot modify the private member variables, but it can modify the public member variables.
A)True
B)False
Q2) Consider the UML class diagram shown in the accompanying figure. Which of the following is the name of the class?
A) clock
B) clockType
C) Type
D) +clockType
Q3) As parameters to a function, class objects can be passed by reference only.
A)True
B)False
Q4) In C++ terminology, a class object is the same as a class instance.
A)True
B)False
Q5) A(n) ____________________ is a statement specifying what is true after the function call is completed.
To view all questions and flashcards with answers, click on the resource link above. Page 13

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) Which of the following is true about inheritance?
A) All public member functions of the base class become the public member functions of the derived class.
B) All public member variables of the base class become the public member variables of the derived class.
C) All public members of the base class become the public members of the derived class.
D) The public member variables of the base class become the public or private member variables of the derived class.
Q2) The constructor of a derived class cannot directly access the ____________________ member variables of the base class.
Q3) If the derived class classD overrides a public member function functionName of the base class classB, then to specify a call to that public member function of the base class you use the statement ____.
A) classD::functionName();
B) classB::functionName();
C) classD.functionName();
D) classB.functionName();
To view all questions and flashcards with answers, click on the resource link above. Page 14

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) Consider the following statement: ptrMemberVarType objectThree(objectOne); The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree. This initialization is called the ____.
A) member-wise assignment
B) default assignment
C) member-wise initialization
D) default initialization
Q2) In ____ binding, the necessary code to call a specific function is generated by the compiler.
A) static
B) dynamic
C) shallow
D) deep
Q3) The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.
A)True
B)False
Q4) The statement that declares board to be a pointer to a pointer is: int
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) Any function that overloads an operator is called a(n) ____________________ function.
Q2) A(n) ____________________ constructor converts its argument to an object of the constructor's class.
Q3) The return type of the function to overload the operator >> must be a reference to a(n) ____ object.
A) iostream
B) ostream
C) stream
D) istream
Q4) The ____________________ operator causes a member-wise copy of the member variables of the class.
Q5) With the exception of the ____________________ operator and the member selection operator, operators must be overloaded to be used on class objects.
Q6) A conversion constructor is a(n) ____________________-parameter function.
Q7) The ____________________ members of a class are local to the class and, therefore, cannot be accessed outside of the class.
Q8) In C++, a function ____________________ can be overloaded.
Page 16
To view all questions and flashcards with answers, click on the resource link above.

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) One of the typical ways of dealing with exceptions is to use an if statement.
A)True
B)False
Q2) The order of the catch blocks does not affect the program.
A)True
B)False
Q3) Which of the following is a valid C++ statement?
A) assert(0 = divisor);
B) assert(divisor != 0);
C) assert(divisor 0);
D) assert(divisor is 0);
Q4) To use the assert function in your program, you should include the statement ____.
A) #include <assert>
B) #include <cassert>
C) #include <iostream>
D) #include <exception>
Q5) If a length greater than the maximum allowed for a string object is used, the class ____________________ deals with the error that occurs.
Q6) The class ____________________ contains the function what.
Page 17
To view all questions and flashcards with answers, click on the resource link above.

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) Which of the following solution methods would be the best choice for a mission control system?
A) Iterative
B) Direct recursive
C) Indirect recursive
D) Infinite recursive
Q2) Let x be an integer. We call the ____________________ of x after division by 2 the rightmost bit of x.
Q3) Tracing through ____ recursion is more tedious than tracing other recursive forms.
A) direct
B) indirect
C) tail
D) iterative
Q4) In the Tower of Hanoi recursive program, if needle 1 contains three disks, then the number of moves required to move all three disks from needle 1 to needle 3 is 8.
A)True
B)False
Q5) Recursive algorithms are implemented using ____________________ functions.
To view all questions and flashcards with answers, click on the resource link above. Page 18

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) A sequential search is much faster than a binary search.
A)True
B)False
Q2) If the search item is the 900th item in the list, the sequential search makes ____ key comparisons to determine whether the search item is in the list.
A) 100
B) 900
C) 9000
D) 90,000
Q3) The sequential search algorithm uses a(n) ____ variable to track whether the item is found.
A) int
B) bool
C) char
D) double
Q4) For a list size of 1000, on average, the sequential search makes about ____________________ key comparisons.
Q5) The statement vector<elemType>____________________; creates the vector object vecList of size n.
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) Consider the accompanying code. What is the effect of the following statement? newNode->info = 50;
A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
Q2) Data can be organized and processed sequentially using an array, called a(n) ____ list.
A) linked
B) ordered C) sequential D) ascending
Q3) Consider the statements above. The operation returns true if the list is empty; otherwise, it returns false. The missing code is ____.
A) protected
B) int C) void
D) bool
Q4) In C++, the dereferencing operator is ____________________.
Q5) In a linked list, the link component of each node is a(n)
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) The postfix expression 14 2 5 + = will generate an error, because ____.
A) it contains an illegal operator
B) it does not have enough operands
C) it has too many operators
D) there will be too many elements in the stack when the equal sign is encountered
Q2) In ____________________ notation, operators are written after the operands.
Q3) If the queue is empty, the operation ____________________ terminates the program.
Q4) In the linked implementation of stacks, the memory to store the stack elements is allocated statically.
A)True
B)False
Q5) If you try to add a new item to a full stack, the resulting condition is called an outflow.
A)True
B)False
Q6) In a queuing system, every customer has a customer number, arrival time, ____________________ time, transaction time, and departure time.
To view all questions and flashcards with answers, click on the resource link above. Page 21