Data Structures and Algorithms (introductory level) Exam Materials - 949 Verified Questions

Page 1


Data Structures and Algorithms (introductory level)

Exam Materials

Course Introduction

This course introduces the fundamental concepts of data structures and algorithms, which are essential building blocks in computer science. Students will explore basic data structures such as arrays, linked lists, stacks, and queues, along with their applications and efficiency considerations. The course also covers foundational algorithms, including searching, sorting, and elementary recursion. Emphasis is placed on analyzing the time and space complexities of algorithms and understanding their practical uses in problem solving. Through lectures and hands-on exercises, students will develop skills to design and implement efficient solutions to computational problems.

Recommended Textbook

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

Available Study Resources on Quizplus

21 Chapters

949 Verified Questions

949 Flashcards

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

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) The two parts of the CPU are

A) the output device and the input device

B) the software and the hardware

C) the Control Unit and the Arithmetic and Logic Unit

D) the single-task device and the multi-task device

E) None of these

Answer: C

Q2) Mistakes that cause a running program to produce incorrect results are called:

A) syntax errors

B) logic errors

C) compiler errors

D) linker errors

E) None of these

Answer: B

Q3) Machine language is an example of a high-level language.

A)True

B)False

Answer: False

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

3

Chapter 2: Introduction to C

Available Study Resources on Quizplus for this Chatper

62 Verified Questions

62 Flashcards

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

Sample Questions

Q1) A statement that starts with a hashtag (or pound) symbol (#) is called a

A) comment

B) function

C) preprocessor directive

D) header file

E) None of these

Answer: C

Q2) What will the following code display?

Int number = 23;

Cout << "The number is " << "number" << endl;

A) The number is 23

B) The number is23

C) The number is number

D) The number is null

E) The number is

Answer: C

Q3) The preprocessor executes after the compiler.

A)True

B)False

Answer: False

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

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) __________ reads a line of input, including leading and embedded spaces, and stores it in a string object.

A) cin.get

B) getline

C) cin.getline

D) get

E) None of these

Answer: B

Q2) You can control the number of significant digits in your output with the __________ manipulator.

A) setprecision

B) set_precision

C) to_fixed

D) setfixed()

E) None of these

Answer: A

Q3) The fixed manipulator causes a number to be displayed in scientific notation.

A)True

B)False

Answer: False

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

51 Verified Questions

51 Flashcards

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

Sample Questions

Q1) What is the value of donuts after the following statement executes?

int donuts = 10; if (donuts != 10)

\(\quad\)donuts = 0; else

\(\quad\)donuts += 2;

A) 12

B) 10

C) 0

D) 1

E) None of these

Q2) Input values should always be checked for

A) an appropriate range

B) reasonableness

C) division by zero, if division is taking place

D) All of these

E) None of these

Q3) The conditional operator takes two operands.

A)True

B)False

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

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) The while loop is a __________ loop.

A) post-test

B) pre-test

C) infinite

D) limited

E) None of these

Q2) You may nest while and do-while loops but you may not nest for loops.

A)True

B)False

Q3) A variable that is regularly incremented or decremented each time a loop iterates is a

A) constant

B) counter

C) control

D) null terminator

E) None of these

Q4) An initialization expression may be omitted from the for loop if no initialization is required.

A)True

B)False

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

Chapter 6: Functions

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

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

Sample Questions

Q1) This statement causes a function to end.

A) end

B) terminate

C) return

D) release

E) None of these

Q2) Select all that apply. Which of the following statement(s) about global variables is(are) true?

A) A global variable is accessible only to the main function.

B) A global variable is declared in the highest-level block in which it is used.

C) A global variable can have the same name as a variable that is declared locally within a function.

D) A global variable is the same as a named constant.

E) If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function.

Q3) It is not considered good programming practice to declare all your variables globally.

A)True

B)False

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

Page 8

Chapter 7: Arrays and Vectors

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) In C++11 the range-based for loop is best used in situations where you need the element subscript for some purpose.

A)True

B)False

Q3) To pass an array as an argument to a function, pass the __________ of the array.

A) contents

B) size, expressed as an integer

C) name

D) value of the first element

E) None of these

Q4) An individual array element can be processed like any other type of C++ variable. A)True

B)False

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

9

Chapter 8: Searching and Sorting Arrays

Available Study Resources on Quizplus for this Chatper

30 Verified Questions

30 Flashcards

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

Sample Questions

Q1) The number of comparisons made by a binary search is expressed in powers of two.

A)True

B)False

Q2) Regardless of the algorithm being used, a search through an array is always performed

A) from lowest to highest element

B) from highest to lowest element

C) beginning with the middle element

D) using a binary search algorithm

E) None of these

Q3) A __________ algorithm is a method of locating a specific item of information in a larger collection of data.

A) sort

B) search

C) standard

D) linear

E) None of these

Q4) A linear search can only be implemented with integer values.

A)True

B)False

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

47 Verified Questions

47 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) With pointer variables you can access but not modify data in other variables.

A)True

B)False

Q3) When you work with a dereferenced pointer, you are actually working with

A) a variable whose memory has been allocated

B) a copy of the value pointed to by the pointer variable

C) the actual value of the variable whose address is stored in the pointer variable

D) None of these

Q4) The unique_ptr is the sole owner of a piece of dynamically allocated memory.

A)True

B)False

Q5) Select all that apply. Which of the following can be used as pointers?

A) array names

B) numeric constants

C) keywords

D) None of these

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

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) The null terminator stands for ASCII code

A) 57

B) 100

C) 1000

D) 0

E) None of these

Q2) The ftoa function converts a floating-point value to an ASCII value.

A)True

B)False

Q3) Given the string shown below, if the delimiter is a space, how many tokens are in the string?

"Tony's email address is tony_g@mycollege.edu"

A) 4

B) 5

C) 6

D) 7

E) 9

Q4) The strlen function returns a C-string's length and adds one for \0.

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

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) The names of enumerators in an enumerated data type must be enclosed in quotation marks.

A)True

B)False

Q2) In C++11 if you want to retrieve a strongly typed enumerator's underlying integer value, you must use a cast operator.

A)True

B)False

Q3) A structure pointer contains

A) the address of a structure variable

B) the dereferenced address of a structure tag

C) the name and address of the structure tag

D) the address of a structure tag

E) None of these

Q4) When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type, as well as what operations may be performed on the data type.

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

Sample Questions

Q1) Which of the following access flags, when used by itself, causes a file's contents to be deleted if the file already exists?

A) ios::app

B) ios::in

C) ios::out

D) Any of these

E) None of these

Q2) Data stored __________ disappears once the program stops running or the computer is powered down.

A) on a CD

B) in RAM

C) on a flash drive

D) on the disk drive

E) None of these

Q3) The ios::out flag causes the file's existing contents to be deleted if the file already exists.

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

54 Verified Questions

54 Flashcards

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

Sample Questions

Q1) Objects in an array are accessed with __________.

A) subscripts

B) parentheses

C) #include statements

D) output format manipulators

E) None of these

Q2) If you do not declare an access specification, the default for members of a class is

A) inline

B) private

C) public

D) global

E) None of these

Q3) Which type of member function may only be called from a function that is a member of the same class?

A) public

B) private C) global

D) local

E) None of these

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

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) A(n) __________ informs the compiler that a class will be declared later in the program.

A) static function

B) private data member

C) forward declaration

D) object conversion

E) None of these

Q2) When you overload an operator, you cannot change the number of __________ taken by the operator.

A) arguments

B) parameters

C) operations

D) operands

E) None of these

Q3) The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all non-static member functions.

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

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.

A)True

B)False

Q2) In C++11, if a derived class attempts to override a final member function, the compiler generates an error.

A)True

B)False

Q3) The __________ constructor is called before the __________ constructor.

A) base, derived

B) derived, base

C) public, private

D) private, public

E) None of these

Q4) C++11 provides a way for a derived class to inherit some of the base class's constructors.

A)True

B)False

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

Chapter 16: Exceptions and Templates

Available Study Resources on Quizplus for this Chatper

36 Verified Questions

36 Flashcards

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

Sample Questions

Q1) An exception thrown from outside a try block will

A) be caught outside the catch block

B) be caught inside the catch block

C) remain inside the throw block

D) cause the program to abort execution

E) None of these

Q2) The try block is immediately followed by one or more

A) errors

B) error messages

C) catch blocks

D) throw blocks

E) None of these

Q3) All type parameters defined in a function template must appear at least once in the A) function parameter list

B) preprocessor directives

C) function call

D) type.h file

E) None of these

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

18

Chapter 17: The Standard Template Library

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) An associative container stores data in a nonsequential way so it is slower to locate elements than a sequence container.

A)True

B)False

Q2) The three sequence container objects provided by the STL are

A) set, multiset, and map

B) vector, deque, and list

C) map, list, and array

D) multimap, map, and multilist

E) None of these

Q3) When an element is stored in a map, it is stored as an object of the __________ type.

A) map

B) key

C) pair

D) key_value

E) None of these

Q4) An iterator is a function that is used to access items in an array.

A)True

B)False

Page 19

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

Chapter 18: Linked Lists

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) To create a linked list you must first create a(n)

A) header file

B) function template

C) exception

D) struct

E) None of these

Q2) The list container provided by the Standard Template Library is a template version of a

A) singly linked list

B) doubly linked list

C) circular linked list

D) backward linked list

E) None of these

Q3) A linked list is a series of connected

A) ADTs

B) vectors

C) algorithms

D) nodes

E) None of these

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

Page 20

Chapter 19: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) For a compiler that is older than C++11 it is necessary to put spaces between the angled brackets that appear next to each other when defining a stack.

A)True

B)False

Q2) A stack that is implemented as a linked list is known as a deque.

A)True

B)False

Q3) Static stacks have a __________ size and are implemented as __________.

A) fixed, linked lists

B) variable, arrays

C) fixed, arrays

D) variable, linked lists

E) None of these

Q4) In a dequeue operation, the element at the __________ of the queue is removed.

A) middle

B) front

C) declaration

D) rear

E) None of these

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

Chapter 20: Recursion

Available Study Resources on Quizplus for this Chatper

27 Verified Questions

27 Flashcards

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

Sample Questions

Q1) The programmer must ensure that a recursive function does not become

A) a static function

B) a virtual function

C) an endless loop

D) a dynamic function

E) None of these

Q2) The __________ algorithm uses recursion to sort a list.

A) shell sort

B) QuickSort

C) binary sort

D) red/black sort

E) None of these

Q3) In a recursive solution, the base case is always the first case to be called.

A)True

B)False

Q4) A recursive function cannot call another function.

A)True

B)False

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

Page 22

Chapter 21: Binary Trees

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

Q1) Binary trees can be divided into

A) branches

B) leaves

C) subtrees

D) sawdust

E) None of these

Q2) To remove a node that has children, you must first remove the children.

A)True

B)False

Q3) The process of stepping through the nodes of a binary tree is known as

A) climbing

B) traversing

C) stepping through

D) branching out

E) None of these

Q4) The width of a tree is the largest number of nodes in the same level.

A)True

B)False

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.
Data Structures and Algorithms (introductory level) Exam Materials - 949 Verified Questions by Quizplus - Issuu