Skip to main content

Computer Science I Test Preparation - 1050 Verified Questions

Page 1


Computer Science I Test Preparation

Course Introduction

Computer Science I is an introductory course that provides students with a foundational understanding of computer science principles and programming. Through a combination of lectures, hands-on labs, and projects, students learn the basics of algorithmic thinking, problem-solving, and software development. The course covers fundamental programming constructs such as variables, data types, conditional statements, loops, functions, and arrays, typically using a modern programming language. Emphasis is placed on developing logical reasoning skills and writing clear, effective code. Students also gain exposure to essential computer science concepts like data representation, debugging techniques, and basic software engineering practices, preparing them for more advanced courses in the field.

Recommended Textbook

C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik

Available Study Resources on Quizplus

21 Chapters

1050 Verified Questions

1050 Flashcards

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

Page 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/128444

Sample Questions

Q1) ____________________ signals represent information with a sequence of 0s and 1s.

Answer: Digital digital

Q2) In a C++ program,statements that begin with the symbol # are called ____________________ directives.

Answer: preprocessor

Q3) C++ programs have always been portable from one compiler to another.

A)True

B)False

Answer: False

Q4) Main memory is an ordered sequence of items,called ____.

A) pixels

B) registers

C) memory cells

D) addresses Answer: C

Q5) The ASCII data set consists of ____________________ characters. Answer: 128

Q6) A sequence of 0s and 1s is sometimes referred to as ____________________ code. Page 3

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

Page 4

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/5305

Sample Questions

Q1) Suppose that alpha and beta are int variables.The statement alpha = ++beta; is equivalent to the statement(s)____.

A) beta = beta + 1;

Alpha = beta;

B) alpha = beta;

Beta = beta + 1;

C) alpha = alpha + beta;

D) alpha = beta + 1;

Answer: A

Q2) Suppose that alpha and beta are int variables and alpha = 5 and beta = 10.After the statement alpha *= beta; executes,____.

A) alpha = 5

B) alpha = 10

C) alpha = 50

D) alpha = 50.0

Answer: C

Q3) A data type is called ____________________ if the variable or named constant of that type can store only one value at a time.

Answer: simple

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

Page 5

Chapter 3: Input/Output

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) cin is called a(n)____________________ object.

Answer: istream

Q2) You can use the function getline to read a string containing blanks.

A)True

B)False

Answer: True

Q3) Suppose that ch1,ch2,and ch3 are variables of the type char and the input is: A B C

What is the value of ch3 after the following statements execute?

cin.get(ch1); cin.get(ch2); cin.get(ch3);

A) 'A'

B) 'B'

C) 'C'

D) '\n'

Answer: B

Q4) In C++,the dot is an operator called the ____________________operator.

Answer: member access

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

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/5307

Sample Questions

Q1) Which of the following operators has the lowest precedence?

A) !

B) ||

C) &&

D) =

Q2) Once an input stream enters a(n)____________________ state,all subsequent input statements associated with that input stream are ignored,and the computer continues to execute the program,which produces erroneous results.

Q3) In C++,&& has a higher precedence than ||.

A)True

B)False

Q4) The symbol > is a(n)____________________ operator.

Q5) The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

A)True

B)False

Q6) The ____________________ of relational and logical operators is said to be from left to right.

Q7) Every else must be paired with a(n)____________________.

Page 7

Q8) In C++,the logical operator AND is represented by ____________________.

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/128467

Sample Questions

Q1) In ____ structures,the computer repeats particular statements a certain number of times depending on some condition(s).

A) looping

B) branching

C) selection

D) sequence

Q2) Consider the following code.(Assume that all variables are properly declared.) cin >> ch; While (cin)

{ \(\quad\)cout << ch; \(\quad\)cin >> ch;

}

This code is an example of a(n)____ while loop.

A) sentinel-controlled

B) flag-controlled

C) EOF-controlled

D) counter-controlled

Q3) In a(n)"____________________" problem,either the loop executes one too many or one too few times.

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

Chapter 6: User-Defined Functions

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) 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

Q2) The standard header file for the abs(x)function is ____.

A) &lt;cmath&gt;

B) &lt;ioinput&gt;

C) &lt;cctype&gt;

D) &lt;cstdlib&gt;

Q3) Given the following function prototype: double tryMe(double,double);,which of the following statements is valid? Assume that all variables are properly declared.

A) cin >> tryMe(x);

B) cout << tryMe(2.0, 3.0);

C) cout << tryMe(tryMe(double, double), double);

D) cout << tryMe(tryMe(float, float), float);

Q4) A(n)____________________ parameter is a formal parameter that receives the location (memory address)of the corresponding actual parameter.

Q5) A function ____________________ is a function that is not fully coded.

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

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/5310

Sample Questions

Q1) Suppose str = "abcd".After the statement str = str + "ABCD"; the value of str is "____________________".

Q2) Which of the following is a valid C++ statement?

A) typedef integer;

B) typedef int; C) typedef int integer; D) typedef integer int;

Q3) The following is a legal C++ enumeration type: enum colorType {BLUE,GREEN,PINK,YELLOW,RED};

A)True

B)False

Q4) Suppose that str1 and str2 are string variables.After the following statements execute,the value of str2 is "____________________".

str1 = "abc";

str2 = str1 + '-';

str2 = str2 + "xyz";

Q5) In ANSI/ISO Standard C++,the ____________________ mechanism was designed to solve the problem of overlapping global identifiers.

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 11

Chapter 8: Arrays and Strings

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) In row order form,the ____.

A) first row is stored first

B) first row is stored last

C) first column is stored first

D) first column is stored last

Q2) Consider the following statement: int alpha[25][10];.Which of the following statements about alpha is true?

A) Rows of alpha are numbered 0...24 and columns are numbered 0...9.

B) Rows of alpha are numbered 0...24 and columns are numbered 1...10.

C) Rows of alpha are numbered 1...24 and columns are numbered 0...9.

D) Rows of alpha are numbered 1...25 and columns are numbered 1...10.

Q3) Given the declaration int list[20]; the statement list[12] = list[5] + list[7]; updates the content of the twelfth component of the array list.

A)True

B)False

Q4) The header file string contains the function ____________________,which converts a value of type string to a null-terminated character array.

Q5) The statement strlen("Marylin Stewart"); returns ____________________.

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

Chapter 9: Records (structs)

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the accompanying struct definition in Figure 1.The statement cout ____________________ outputs the variables firstName and lastName separated by one space.

Q2) Consider the accompanying struct definition in Figure 1.The statement ____________________ defines alumnus to be a struct variable of type newStudent.

Q3) A list has two items associated with it: ____.

A) the length and the references

B) the values and the references

C) the indexes and the length

D) the values and the length

Q4) In C++,the ____ symbol is an operator,called the member access operator.

A) :(colon)

B) .(dot)

C) ,(comma)

D) $ (dollar sign)

Q5) You can use an assignment statement to copy the contents of one struct into another struct of the same type.

A)True

B)False

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

Chapter 10: Classes and Data Abstraction

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A class is an example of a structured data type.

A)True

B)False

Q2) The components of a class are called the ____ of the class.

A) elements

B) members

C) objects

D) properties

Q3) As parameters to a function,class objects can be passed by reference only.

A)True

B)False

Q4) A(n)____________________ is a statement specifying the condition(s)that must be true before the function is called.

Q5) You can use arithmetic operators to perform arithmetic operations on class objects.

A)True

B)False

Q6) A(n)____________________ statement is required by any program that uses a header class file,as well as by the implementation file that defines the operations for that class.

Page 14

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

Chapter 11: Inheritance and Composition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The constructor of a derived class cannot directly access the ____________________ member variables of the base class.

Q2) If the derived class does not override a public member function of the base class,you may specify a call to that public member function by using the name of the function and the appropriate parameter list.

A)True

B)False

Q3) In ____________________ polymorphism,the (data)type is left unspecified and then later instantiated.

Q4) The preprocessor directive ____________________ is used to prevent multiple inclusions of a header file in a program.

Q5) Inheritance is an example of a(n)____ relationship.

A) is-a

B) has-a

C) handshaking

D) had-a

Q6) In C++,we implement ADT through the use of ____________________.

Q7) Objects are created when ____________________ variables are declared.

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

Q8) In ____________________,the derived class is derived from a single base class.

Chapter 12: Pointers, Classes, Virtual Functions, Abstract

Classes, and Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A memory leak is an unused memory space that cannot be allocated.

A)True

B)False

Q2) A list is a collection of elements of the same type.

A)True

B)False

Q3) Which of the following operations is allowed on pointer variables?

A) exp

B) %

C) ==

D) /

Q4) The C++ operator ____ is used to create dynamic variables.

A) dynamic

B) new

C) virtual

D) dereferencing

Q5) The ____________________ of a list is the number of elements in the list.

Page 16

Q6) The statement that declares board to be a pointer to a pointer is: int

Q7) The binding of virtual functions occurs at program

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

Page 17

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Every object of a class maintains a (hidden)pointer to itself,and the name of this pointer is ____.

A) self

B) object

C) it

D) this

Q2) The only built-in operations on classes are assignment (=)and ____________________.

Q3) Passing a parameter to a class template has an effect at ____________________ time.

Q4) The ____________________ operator causes a member-wise copy of the member variables of the class.

Q5) The associativity of the operator = is from right to left.

A)True

B)False

Q6) Class templates are called ____ types.

A) polymorphic

B) structured

C) member

D) parameterized

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following classes is derived from the class runtime_error?

A) bad_alloc

B) out_of_range

C) overflow_error

D) length_error

Q2) To use the assert function in your program,you should include the statement ____.

A) #include &lt;assert&gt;

B) #include &lt;cassert&gt;

C) #include &lt;iostream&gt;

D) #include &lt;exception&gt;

Q3) Throwing an exception is typically done using the ____________________ statement.

Q4) Which of the following statements throws a valid exception in C++?

A) throw.function();

B) throw 2;

C) throws str;

D) 4 throw;

Q5) The class ____________________ deals with the string subscript out of range error.

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A function is called ____ if it calls itself.

A) directly iterative

B) indirectly iterative

C) directly recursive

D) indirectly recursive

Q2) The numbering system that the computer uses is called the ____________________ system.

Q3) If a function A calls function B and function B calls function A,then function A is ____________________ recursive.

Q4) In a recursive function,the base case stops the recursion.

A)True

B)False

Q5) Every call to a recursive function requires the system to allocate memory for the local variables and formal parameters.

A)True

B)False

Q6) With recursion,the base case must eventually be reduced to a general case.

A)True

B)False

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

Chapter 16: Linked Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A linked list must be searched ____________________,starting from the first node.

Q2) Consider the following code: template &lt;class Type&gt; Int doublyLinkedList&lt;Type&gt;::length()const

{ }

The statement that provides the length of the linked list is ____.

A) cout <<&lt; count;

B) destroy();

C) return count;

D) return next;

Q3) Each node of a linked list must store the data as well as the ____________________ for the next node in the list.

Q4) In a linked list,the link component of each node is a(n)____________________.

Q5) In a circular linked list with more than one node,it is convenient to make the pointer first point to the ____________________ node of the list.

Q6) The ____________________ constructor executes when an object is declared and initialized using another object.

Page 21

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

Chapter 17: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The postfix expression 2 4 6 * + 15 - 21 7 / + = evaluates to ____.

A) 4

B) 14

C) 24

D) 26

Q2) The addition and deletion of elements of the stack occurs only at the ____ of the stack.

A) head

B) bottom

C) top

D) middle

Q3) The infix expression

(a + b)* (c - d / e)+ f is equivalent to the postfix expression ab + cde /-* f +

A)True

B)False

Q4) In a queuing system,we use a(n)____________________ variable to set the status of the server.

Q5) In ____________________ notation,operators are written after the operands.

Page 22

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

Chapter 18: Searching and Sorting Algorithms

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) We can trace the execution of a comparison-based algorithm by using a graph called a ____.

A) pivot table

B) partition table

C) comparison tree

D) merge tree

Q2) The sequential search algorithm does not require that the list be sorted.

A)True

B)False

Q3) The formula to find the index of the middle element of a list is ____.

A) (mid + last)/2

B) (first + last) - 2

C) (first + last) / 2

D) (first + mid ) * 2

Q4) ____ sort requires knowing where the middle element of the list is.

A) Merge

B) Bubble

C) Insertion

D) Selection

Q5) The top node of a comparison tree is call the ____________________ node.

Page 23

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

Chapter 19: Binary Trees

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider that A is a binary tree,C and D are the subtrees of A.Which of the following statements is always true?

A) C and D are binary trees.

B) C and D are search binary trees.

C) C and D are empty trees.

D) A is empty.

Q2) Let T be a binary search tree with n nodes,in which n > 0.The average number of nodes visited in a search of T is approximately O(____________________).

Q3) After deleting the desired item from a binary search tree,the resulting tree must be a binary search tree.

A)True

B)False

Q4) A binary tree is also a(n)____.

A) stack

B) linked list

C) graph

D) array

Q5) The ____________________ of a binary tree is the number of nodes on the longest path from the root to a leaf.

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

Chapter 20: Graphs

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A tree T is called a(n)____ tree of graph G if T is a subgraph of G such that V(T)= V(G); that is,if all vertices of G are in T.

A) weighted

B) spanning

C) rooted

D) directed

Q2) In Prim's algorithm for the minimal spanning tree,we start at a designated vertex,which we call the ____ vertex.

A) index

B) source

C) root

D) destination

Q3) A set Y is called a(n)____________________ of X if every element of Y is also an element of X.

Q4) The ____________________ algorithm gives the shortest distance for a given node to every other node in the graph.

Q5) A binary tree has no cycles.

A)True

B)False

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

Chapter 21: Standard Template Library (STL)

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The container member function ____ returns the position of one past the last element in the container.

A) last

B) end

C) back

D) pop

Q2) The operator ____________________,supported by the queue container class,returns the next (i.e.,first)element in the queue,but does not remove the element from the queue.

Q3) ____ is a sequence container.

A) vector

B) stack

C) queue

D) set

Q4) Every container contains the typedef ____________________.An iterator of this type is used to iterate through the elements of a container in reverse.

Q5) Functions begin and end do not take any parameters.

A)True

B)False

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

Turn static files into dynamic content formats.

Create a flipbook
Computer Science I Test Preparation - 1050 Verified Questions by Quizplus - Issuu