Introduction to Computer Science Solved Exam Questions - 891 Verified Questions

Page 1


Introduction to Computer Science Solved

Exam Questions

Course Introduction

Introduction to Computer Science offers a comprehensive overview of the fundamental concepts and principles that form the foundation of computing. Students will explore topics such as algorithms, programming languages, data structures, computer hardware, software development, and problem-solving techniques. The course introduces the basics of coding through hands-on practice, typically using a beginner-friendly language, and highlights the role of computers in various fields. By the end of the course, students will have developed analytical thinking skills and a solid understanding of how computers work, preparing them for more advanced study in computer science.

Recommended Textbook

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

Available Study Resources on Quizplus

20 Chapters

891 Verified Questions

891 Flashcards

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

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) What statement best describes a variable and its primary purpose?

A)A variable is a structured, general-purpose language designed primarily for teaching programming.

B)A variable is a collection of eight bits.

C)A variable is a word that has a special meaning to the compiler.

D)A variable is a named storage location in the computer's memory used for holding a piece of information.

E)A variable is a "line" of code in the body of a program, which may change.

Answer: D

Q2) Which of the following is a common input device?

A)Keyboard

B)Mouse

C)Scanner

D)Microphone

E)All of the above

Answer: E

Q3) The term "bit" stands for binary digit.

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 Plus Plus

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) Assume that a program has the following string object definition: string name; Which of the following statements correctly assigns a string literal to the string object?

A)name = Jane;

B)name = "Jane";

C)name = 'Jane';

D)name = (Jane);

Answer: B

Q2) This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.

A)len

B)bytes

C)f(x)

D)int

E)sizeof Answer: E

Q3) C++ does not have a built in data type for storing strings of characters.

A)True

B)False

Answer: True

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

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) In any program that uses the cin object, you must include the ________.

A)compiler

B)iostream header file

C)linker

D)>> and << operators

E)None of the above

Answer: B

Q2) This stream manipulator forces cout to print the digits in fixed-point notation.

A)setprecision(2)

B)setw(2)

C)fixed

D)setfixed(2)

E)None of these

Answer: C

Q3) The cin << statement will stop reading input when it encounters a newline character.

A)True

B)False

Answer: True

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

53 Verified Questions

53 Flashcards

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

Sample Questions

Q1) This operator is known as the logical OR operator.

A)--

B)//

C)#

D)||

E)None of these

Q2) If you place a semicolon after the statement: if (x < y)

A)The code will not compile.

B)The compiler will interpret the semicolon as a null statement.

C)The if statement will always evaluate to false.

D)All of the above

E)None of these

Q3) These operators connect two or more relational expressions into one, or reverse the logic of an expression.

A)relational

B)logical

C)irrational

D)negation

E)None of these

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

63 Verified Questions

63 Flashcards

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

Sample Questions

Q1) To read data from a file, you define an object of this data type.

A)inputFile

B)ifstream

C)fstream

D)ofstream

Q2) Multiple relational expressions cannot be placed into the test condition of a for loop.

A)True

B)False

Q3) It is possible to define a file stream object and open a file in one statement.

A)True

B)False

Q4) This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning.

A)do-while

B)while

C)for

D)infinite

E)None of these

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

Chapter 6: Functions

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

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

Sample Questions

Q1) This is a collection of statements that performs a specific task.

A)infinite loop

B)variable

C)constant

D)function

E)None of these

Q2) A function's return data type must be the same as the function's parameter(s).

A)True

B)False

Q3) It is possible for a function to have some parameters with default arguments and some without.

A)True

B)False

Q4) This statement causes a function to end.

A)end

B)terminate

C)return

D)release

E)None of these

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

Chapter 7: Arrays

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) Unlike regular variables, these can hold multiple values.

A)constants

B)named constants

C)arrays

D)floating-point variables

E)None of these

Q2) Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.

A)True

B)False

Q3) Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?

A)vector n&lt;int&gt;(10, 20);

B)vector&lt;int&gt; n = {10, 20};

C)vector&lt;int&gt; n { 10, 20 };

D)int vector n ({10}, {20});

Q4) When you pass an array as an argument to a function, the function can modify the contents of the array.

A)True

B)False

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

20 Verified Questions

20 Flashcards

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

Sample Questions

Q1) Array elements must be ________ before a binary search can be performed.

A)summed

B)set to zero

C)sorted

D)positive numbers

E)None of these

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

A)20,000

B)only the first

C)only half

D)2000

E)None of these

Q3) A(n)________ search is more efficient than a ________ search.

A)character, string

B)integer, double

C)binary, linear

D)linear, binary

E)None of these

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

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) A function may return a pointer, but the programmer must ensure that the pointer

A)still points to a valid object after the function ends

B)has not been assigned an address

C)was received as a parameter by the function

D)has not previously been returned by another function

E)None of these

Q2) In C++ 11, the nullptr key word was introduced to represent the address 0.

A)True

B)False

Q3) When this is placed in front of a variable name, it returns the address of that variable.

A)asterisk ( * )

B)conditional operator

C)ampersand ( & )

D)semicolon ( ; )

E)None of these

Q4) The ampersand (&)is used to dereference a pointer variable in C++.

A)True

B)False

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

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

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) The C-string company[12] can hold ________.

A)twelve characters

B)thirteen characters

C)eleven characters and the null terminator

D)twelve characters and the null terminator

E)None of the above

Q2) In C++, a C-string is a sequence of characters stored in consecutive memory, terminated by a ________.

A)period

B)space

C)null character

D)semicolon

E)None of these

Q3) The C++ compiler performs strict array bounds checking when it encounters an array of characters.

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

53 Verified Questions

53 Flashcards

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

Sample Questions

Q1) This describes only the general characteristics of an object.

A)initialization

B)abstraction

C)detailed specification

D)initiation

E)None of these

Q2) A union can only have one member.

A)True

B)False

Q3) It is possible for a structure to contain as a member a pointer to its own structure type.

A)True

B)False

Q4) An anonymous union declaration actually creates the member variables in memory.

A)True

B)False

Q5) When you use a strongly typed enumerator in C++ 11, you must prefix the enumerator with the name of the enum, followed by the :: operator.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 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/30146

Sample Questions

Q1) When you store data in a variable, it is automatically saved in a file.

A)True

B)False

Q2) This data type can be used to create files, read data from them, and write data to them.

A)ofstream

B)iftream

C)fstream

D)stream

E)None of these

Q3) When passing a file stream object to a function, you should always pass it by reference.

A)True

B)False

Q4) The setprecision manipulator cannot be used to format data written to a file.

A)True

B)False

Q5) Only one file stream object can be declared per C++ program.

A)True

B)False

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

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) Class declarations are usually stored here.

A)on separate disk volumes

B)in their own header files

C)in .cpp files, along with function definitions

D)under pseudonyms

E)None of these

Q2) One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.

A)True

B)False

Q3) Object-oriented programming is centered around the object, which encapsulate together both the data and the functions that operate on the data.

A)True

B)False

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

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A static member function does not need to be called by a specific object of the class.

A)True

B)False

Q2) A reason to overload the ________ is to write classes that have array-like behaviors.

A)parentheses ( )operator

B)curly braces { } operator

C)square brackets [ ] operator

D)colon : : operator

E)None of these

Q3) You can overload the conditional operator to make it function as an unconditional operator.

A)True

B)False

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

A)True

B)False

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

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A ________ of a base class expects to be overridden in a derived class.

A)constructor function

B)destructor function

C)static function

D)virtual function

E)None of these

Q2) The ________ destructor is called before the ________ destructor.

A)base, derived

B)derived, base

C)public, private

D)private, public

E)None of these

Q3) In an inheritance situation, the new class that you create from an existing class is known as the ________.

A)derived class

B)inheritor

C)child class

D)A and C

E)None of these

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

Chapter 16: Exceptions, Templates, and the Standard

Template Library Stl

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

Q1) An associative container uses ________ to access elements rapidly.

A)data

B)functions

C)keys

D)complex sort algorithms

E)None of these

Q2) An exception thrown from outside a try block ________.

A)will be caught outside the catch block

B)will be caught inside the catch block

C)will remain inside the throw block

D)will cause the program to abort execution

E)None of these

Q3) In a function template, the programmer substitutes ________ for ________.

A)parameters, data types

B)parameters, arguments

C)arguments, parameters

D)angle brackets, parentheses

E)None of these

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

Chapter 17: Linked Lists

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) If new data needs to be added to a linked list, the program simply ________ and inserts it into the series.

A)allocates another node

B)removes a node

C)borrows a node from the compiler

D)Either B or C

E)None of these

Q3) A new node must always be made the last node in the list.

A)True

B)False

Q4) The ________ of a linked list points to the first node in the list.

A)starter

B)head

C)tail

D)declaration

E)None of these

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

Chapter 18: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) A ________ stack or queue is built around the linked-list.

A)dynamic

B)static

C)deque-based

D)floating point

E)None of these

Q2) Two primary queue operations are:

A)push and pop

B)enqueue and dequeue

C)insert and delete

D)onqueue and offqueue

E)None of these

Q3) The pop function in the stack template does not retrieve the value from the top of the stack. It merely removes it.

A)True

B)False

Q4) Stacks and queues can be implemented as arrays or linked lists.

A)True

B)False

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

Chapter 19: Recursion

Available Study Resources on Quizplus for this Chatper

22 Verified Questions

22 Flashcards

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

Sample Questions

Q1) When a recursive function directly calls itself, this is known as direct recursion.

A)True

B)False

Q2) Like a loop, a recursive function must have some method to control the number of times it repeats.

A)True

B)False

Q3) The ________ of recursion is the number of times a recursive function calls itself.

A)level

B)breadth

C)type

D)depth

E)None of these

Q4) The speed and amount of memory available to modern computers diminishes the performance impact of recursion so much that inefficiency is no longer a strong argument against it.

A)True

B)False

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

Page 21

Chapter 20: Binary Trees

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) All nodes to the right of a node hold values greater than the node's value.

A)True

B)False

Q2) The preorder method of traversing a binary tree involves processing the node's data, traversing the node's left subtree, then traversing the node's right subtree.

A)True

B)False

Q3) The first node in a binary tree list is called the ________.

A)head pointer

B)binary node

C)root node

D)pointer node

E)None of these

Q4) Output will be the same if you use inorder, postorder, or preorder traversals of the same binary tree.

A)True

B)False

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

22

Turn static files into dynamic content formats.

Create a flipbook