Computer Science I Exam Bank - 881 Verified Questions

Page 1


Computer Science I Exam Bank

Course Introduction

Computer Science I is an introductory course designed to provide students with a foundational understanding of computational thinking, programming concepts, and problem-solving techniques. Students will learn the basics of algorithm development, data types, control structures, functions, and object-oriented programming using a modern programming language such as Python or Java. The course emphasizes hands-on practice through coding assignments and projects that reinforce core concepts, preparing students for advanced study in computer science and related fields. No prior programming experience is required, making this an ideal starting point for those new to the discipline.

Recommended Textbook

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

Available Study Resources on Quizplus

21 Chapters

881 Verified Questions

881 Flashcards

Source URL: https://quizplus.com/study-set/3128 Page 2

Chapter 1: An Overview of Computers and Programming Languages

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The devices that feed data and programs into computers are called output devices.

A)True

B)False

Answer: False

Q2) The basic commands that a computer performs are ____, and performance of arithmetic and logical operations.

A) input, file, list

B) output, folder, storage

C) input, output, storage

D) storage, directory, log

Answer: C

Q3) The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) is called primary storage.

A)True

B)False

Answer: False

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

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

Sample Questions

Q1) The memory space for a(n) ____________________ data value is 64 bytes. Answer: long long

Q2) ____________________ functions are those that have already been written and are provided as part of the system. Answer: Predefined predefined Standard standard

Q3) In C++, you can use a(n) ____________________ to instruct a program to mark those memory locations in which data is fixed throughout program execution. Answer: named constant constant

Q4) The maximum number of significant digits in values of the double type is 15. A)True B)False Answer: True

Q5) 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 4

Chapter 3: Inputoutput

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Suppose that x and y are int variables.Which of the following is a valid input statement?

A) cin >> x >> cin >> y;

B) cin >> x >> y;

C) cin << x << y;

D) cout << x << y;

Answer: B

Q2) The function ____________________ returns the next character in the input stream; it does not remove the character from the input stream.

Answer: peek

Q3) ____ is a parameterized stream manipulator.

A) endl

B) fixed

C) scientific

D) setfill

Answer: D

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

A)True

B)False

Answer: True

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Suppose that x is an int variable.Which of the following expressions always evaluates to true?

A) (x > 0) || ( x <= 0)

B) (x >= 0) || (x == 0)

C) (x > 0) && ( x <= 0)

D) (x > 0) && (x == 0)

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

Q3) Which of the following operators has the highest precedence?

A) !

B) *

C) %

D) =

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

A)True

B)False

Q5) The operators !, &&, and || are called relational operators. A)True

B)False

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Which of the following is a repetition structure in C++?

A) if

B) switch

C) while...do

D) do...while

Q2) The ____________________ statement is typically used for two purposes: To exit early from a loop.

To skip the remainder of a switch structure.

Q3) A loop ____________________ is a set of statements that remains true each time the loop body is executed.

Q4) What executes immediately after a continue statement in a while and do-while loop?

A) loop-continue test

B) update statement

C) loop condition

D) the body of the loop

Q5) In a while and for loop, the loop condition is evaluated before executing the body of the loop.Therefore, while and for loops are called ____________________ loops.

Q6) The function eof is a member of the data type ____________________.

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

Chapter 6: User-Defined Function

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____.

A) 11.0

B) 12.0

C) 13.0

D) 14.0

Q2) If a function needs to return more than one value, as a rule of good programming style, you should change it to a(n) ____________________ function and use the appropriate reference parameters to return the values.

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) The output of the statement:cout << tolower('$') << endl; is ____.

A) '$'

B) '0'

C) '1'

D) An error, because you cannot use tolower with '$'.

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 8

Chapter 7: Namespaces, the Class String, and

User-Defined Simple Data Types

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The identifiers in the system-provided header files such as iostream, cmath, and iomanip are defined in the namespace ____.

A) cctype

B) stdl

C) std

D) stdlib

Q2) The following statement creates an anonymous type:enum {1ST, 2ND, 3RD, 4TH} places;

A)True

B)False

Q3) In C++, namespace is a reserved word.

A)True

B)False

Q4) The string expression strVar.____________________ inserts all the characters of str at index pos into strVar.

Q5) A data type wherein you directly specify values in the variable declaration with no type name is called a(n) ____________________type.

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

Q6) The values in the domain of an enumeration type are called

Chapter 8: Arrays

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Consider the following statement: double alpha[10][5];.The number of components of alpha is ____.

A) 15

B) 50

C) 100

D) 150

Q2) Suppose that sales is an array of 50 components of type double.Which of the following correctly initializes the array sales?

A) for (int 1 = 1; j <= 49; j++)

Sales[j] = 0;

B) for (int j = 1; j <= 50; j++)

Sales[j] = 0;

C) for (int j = 0; j <= 49; j++)

Sales[j] = 0.0;

D) for (int j = 0; j <= 50; j++)

Sales[j] = 0.0;

Q3) The ____________________ of an array is the address (that is, the memory location) of the first array component.

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

10

Chapter 9: Records Structs

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A struct is typically a ____ data structure.

A) simple

B) dynamic

C) heterogeneous

D) linked

Q2) The syntax for accessing a struct member is structVariableName____.

A) .memberName

B) *memberName

C) [memberName]

D) $memberName

Q3) Which of the following aggregate operations can be executed on array variables?

A) Arithmetic

B) Assignment

C) Function returning a value

D) Parameter passing by reference

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

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

43 Verified Questions

43 Flashcards

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

Sample Questions

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

Q2) With ____________________ functions, the definitions of the member functions are placed in the implementations file.

Q3) How many destructors can a class have?

A) no explicit destructors

B) one

C) two

D) any number

Q4) A member function of a class that only accesses the value(s) of the data member(s) is called a(n) ____ function.

A) accessor

B) mutator

C) constructor

D) destructor

Q5) In C++, class is a reserved word and it defines only a data type.

A)True

B)False

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

41 Verified Questions

41 Flashcards

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

Sample Questions

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

A) is-a

B) has-a

C) handshaking

D) had-a

Q2) ____ is the ability to use the same expression to denote different operations.

A) Inheritance

B) Encapsulation

C) Polymorphism

D) Composition

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();

Q4) A derived class cannot directly access public members of a base class.

A)True

B)False

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

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) Given the statement double *p;, the statement p++; will increment the value of p by ____ byte(s).

A) one

B) two

C) four

D) eight

Q2) The ____ constructor is executed when an object is declared and initialized by using the value of another object.

A) default

B) copy

C) struct

D) class

Q3) Which of the following can be used to initialize a pointer variable?

A) 1

B) nullptr

C) "0"

D) '0'

Q4) In C++, the member access operator arrow is >>.

A)True

B)False

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

Chapter 13: Operator Overloading and Templates

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) A(n) ____________________ constructor converts its argument to an object of the constructor's class.

Q2) Suppose cType is a class template, which can take int as a parameter.The statement: ____ declares x to be an object of type cType, and the type passed to the class cType is int.

A) cType&lt;int&gt; x;

B) cType int x;

C) cType int = x;

D) cType int :: x;

Q3) The general form of the functions to overload the binary operators as member functions of a class is returnType operator#(____ className&) const;.

A) class

B) const

C) *

D) &

Q4) In C++, >> is used as a stream extraction operator and as a right shift operator.

A)True

B)False

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) When division by zero occurs and the problem is not addressed, the program crashes with an error message that is ____ dependent.

A) code

B) computer

C) platform

D) IDE

Q2) If no exception is thrown in a try block, all catch blocks associated with that try block are ignored.

A)True

B)False

Q3) Suppose you have written a program that inputs data from a file.If the input file does not exist when the program executes, then you should choose which option?

A) Terminate the program.

B) Include code in the program to recover from the exception.

C) Log the error and continue.

D) Include code in the header file.

Q4) The ____________________ of the catch block parameter specifies the type of exception that the catch block can catch.

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

Page 16

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) Infinite recursions execute forever on a computer.

A)True

B)False

Q2) Which of the following solutions is easier to construct for the Tower of Hanoi problem?

A) Recursive

B) Iterative

C) Procedural

D) Step-by-step

Q3) Consider the accompanying definition of a recursive function.What is the output of the following statement? cout << recFunc(8) << endl;

A) 4

B) 8

C) 72

D) 720

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

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 17

Chapter 16: Linked Lists

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

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) Which of the following correctly initializes a doubly linked list in the default constructor?

A) head = nullptr;

Back = nullptr;

B) head = 0;

Back = 0;

Count = 0;

C) first = 0;

Last = 0;

D) first = nullptr;

Last = nullptr; Count = 0;

Q3) For classes that include pointer data members, the assignment operator must be explicitly ____________________.

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

Chapter 17: Stacks and Queue

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) The ____ element of the stack is the last element added to the stack.

A) top

B) bottom

C) head

D) tail

Q2) A technique in which one system models the behavior of another system is called

A) imitation

B) recursion

C) simulation

D) stimulation

Q3) You can perform the add operation, called ____, to add an element onto the stack.

A) pop

B) push

C) enqueue

D) dequeue

Q4) Postfix notation requires the use of parentheses to enforce operator precedence.

A)True

B)False

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

Chapter 18: Searching and Sorting Algorithms

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) For a list of length n, the bubble sort makes exactly ____________________ key comparisons.

Q2) With insertion sort, the variable firstOutOfOrder is initialized to ____, assuming n is the length of the list.

A) 0

B) 1

C) n - 1

D) n

Q3) If n = 1000, to sort the list, bubble sort makes about ____ item assignments.

A) 10,000

B) 100,000

C) 250,000

D) 500,000

Q4) During the sorting phase of insertion sort, the array containing the list is divided into two sublists, sorted and unsorted.

A)True

B)False

Q5) In a quick sort, all of the sorting work is done by the function

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

Chapter 19: Binary Trees

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) The ____________________ of a path in a binary tree is the number of branches on that path.

Q2) A binary tree is empty if root is ____.

A) '0'

B) 1

C) "zero"

D) nullptr

Q3) In addition to the inorder, preorder, and postorder traversals, a binary tree can also be traversed level-by-level, which is also known as ____________________ traversal.

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

A)True

B)False

Q5) The ____ of a node in a binary tree is the number of branches on the path from the root to the node.

A) height

B) level

C) width

D) size

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

Chapter 20: Graph Algorithms

Available Study Resources on Quizplus for this Chatper

48 Verified Questions

48 Flashcards

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

Sample Questions

Q1) The ____ of sets A and B is the set of all elements that are in A or in B.

A) intersection

B) union

C) graph

D) reunion

Q2) A(n) ____________________ ordering of the vertices of the accompanying graph is 0, 1, 4, 3, 2, 5, 7, 8, 6, 9.

Q3) The shortest path algorithm was developed by ____.

A) Euler

B) Kruskal

C) Prim

D) Dijkstra

Q4) The shortest path is the path with the smallest ____.

A) length

B) index

C) weight

D) key

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

Q6) A graph is ____________________ if the number of vertices is zero.

Page 22

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

Chapter 21: Standard Template Library

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) If data needs to be processed in a LIFO manner, use a ____.

A) stack

B) linked list

C) queue

D) deque

Q2) The deq.front() operation on a deque object checks whether the container is empty.

A)True

B)False

Q3) The first element in a vector container is at location 1.

A)True

B)False

Q4) The ____ operation removes the first element from the deque object deq.

A) deq.front()

B) deq.push_front()

C) deq.pop_front()

D) deq.push()

Q5) The ____________________ iterators are used to output data from a program into an output stream.

Q6) ____________________ predicates check a specific property for a single argument.

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
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Computer Science I Exam Bank - 881 Verified Questions by Quizplus - Issuu