Problem Solving with Computers Exam Solutions - 949 Verified Questions

Page 1


Problem Solving with Computers

Exam Solutions

Course Introduction

Problem Solving with Computers introduces students to the fundamental concepts and techniques required to tackle real-world problems using computational methods. The course covers key topics such as algorithm development, flowcharting, and the basics of programming languages, emphasizing logical thinking and systematic approaches to breaking down complex challenges. Students will learn to design, implement, and test simple computer programs, gaining practical skills in debugging and optimizing solutions. Through hands-on projects and exercises, the course aims to develop critical thinking, creativity, and a solid understanding of how computers can be utilized effectively to solve a variety of problems across disciplines.

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

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) Programs are often referred to as hardware.

A)True

B)False Answer: False

Q2) In programming, the terms "line" and "statement" always mean the same thing.

A)True

B)False Answer: False

Q3) The first step in writing a program is to

A) type the code

B) visualize the program running on a computer

C) visualize logical errors

D) clearly define what the program is to do

E) None of these

Answer: D

Q4) Pseudocode is a form of a program statement that will always evaluate to "False."

A)True

B)False Answer: False

To view all questions and flashcards with answers, click on the resource link above. Page 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) What will the following code display?

Cout << "Roses " << "are red";

Cout << "and " << "violets/n"

Cout << "are" << "blue" << endl;

A) Roses are red And violets

Are blue

B) Roses are red and violets/nare blue

C) Roses are redand violets/nareblue

D) Roses are red and violets/n are blue

Answer: C

Q2) C++ 11 introduced an alternative way to define variables, using the template key word and an initialization value.

A)True

B)False

Answer: False

Q3) A value is stored in a variable with an assignment statement. 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

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) What is the value of number after the following statements execute?

Int number = 10;

Number += 5;

Number -= 2;

Number *= 3;

A) 3

B) 30

C) 39

D) 2

E) None of these

Answer: C

Q2) The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key.

A)True

B)False

Answer: True

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) As a rule of style, when writing an if statement you should indent the conditionally-executed statements.

A)True

B)False

Q2) The default section of a switch statement performs a similar task similar to the __________ portion of an if/else if statement.

A) conditional

B) break

C) trailing else

D) All of these

E) None of these

Q3) Relational operators allow you to __________ numbers.

A) add

B) multiply

C) compare

D) average

E) None of these

Q4) The default section is required in a switch statement.

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) A file must be __________ before data can be written to or read from it.

A) opened

B) closed

C) named

D) buffered

E) initialized

Q2) What will the following code display? int number = 6; ++number;

cout << number << endl;

A) 6

B) 5

C) 7

D) 0

Q3) A special value that marks the end of a list of values is a A) constant

B) counter

C) variable

D) sentinel

E) None of these

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) Select all that apply. Which of the following must be included in a function header?

A) the data type of each parameter

B) the data type of the return value

C) the name of the function

D) the names of parameter variables

Q2) The value in a __________ variable persists between function calls.

A) dynamic

B) global

C) floating-point

D) static local

E) counter

Q3) A parameter is a special purpose variable that is declared inside the parentheses of a function definition.

A)True

B)False

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

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) C++ limits the number of array dimensions to two.

A)True

B)False

Q2) Assume array1 and array2 are the names of two arrays. To assign the contents of array2 to array1, you would use the following statement: array1 = array2;

A)True

B)False

Q3) This vector function returns the number of elements in a vector.

A) size

B) num_elements

C) elements

D) length

Q4) Which of the following is a valid C++ array definition?

A) int array[0];

B) float $payments[10.23];

C) int numbers[5.6];

D) int scores[25];

E) None of these

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

30 Verified Questions

30 Flashcards

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

Sample Questions

Q1) A __________ search is more efficient than a __________ search.

A) character, string

B) integer, double

C) binary, linear

D) linear, binary

E) None of these

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

A) 20,000

B) only the first two

C) only half

D) 2,000

E) None of these

Q3) Data that is to be sorted in ascending order is ordered

A) from lowest value to highest value

B) from highest value to lowest value

C) with a binary search algorithm

D) by identifying the middle value and going up and down from there

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

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) In C++11 you can use smart pointers to dynamically allocate memory and not worry about deleting the memory when you are finished using it.

A)True

B)False

Q2) What will the following code output?

Int number = 22;

Int *var = &number;

Cout << var << endl;

A) the address of number

B) 22

C) an asterisk followed by 22

D) an asterisk followed by the address of number

Q3) A pointer can be used as a function argument, giving the function access to the original argument.

A)True

B)False

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

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) The arguments of the strcpy function are

A) two C-strings

B) two addresses

C) three pointers

D) one array and one pointer

E) None of these

Q2) You may use the <, >, <=, >=, ==, and != relational operators to compare string objects.

A)True

B)False

Q3) The null terminator stands for ASCII code

A) 57

B) 100

C) 1000

D) 0

E) None of these

Q4) The itoa function is similar to atoi but it works in reverse.

A)True

B)False

Page 12

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

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) A function __________ return a structure.

A) may

B) may not

C) will always

D) can never

E) None of these

Q2) A struct can contain members with varying data types.

A)True

B)False

Q3) Given the following structure decaration, idNum is struct Employee { String name; Int idNum; };

A) a member

B) an array

C) a tag

D) None of these

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) To write to a file, you use the file_write function.

A)True

B)False

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

A)True

B)False

Q3) When data is read from a file, it is automatically stored in a variable.

A)True

B)False

Q4) Which of the following is the member function that can be used to store binary data to a file?

A) binary.out

B) write

C) put <<

D) dataout(binary)

E) None of these

Q5) The ios::hardfail bit is set when an unrecoverable error occurs.

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) Which of the following is a directive used to create an "include guard" that allows a program to be conditionally compiled to prevent a header file from accidentally being included more than once?

A) #include

B) #guard

C) #ifndef

D) #endif

E) None of these

Q2) When a member function is defined outside of the class declaration, the function name must be qualified with the

A) class name, followed by a semicolon

B) name of the first object

C) class name, followed by the scope resolution operator

D) private access specifier

E) None of these

Q3) Class objects can be defined prior to the class declaration.

A)True

B)False

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

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 reason to overload the __________ is to allow you 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

Q2) If you do not furnish a __________, a default one will be provided by the compiler.

A) constructor

B) destructor

C) copy constructor

D) All of these

E) None of these

Q3) You may overload any C++ operator and you may use the operator function to define non-standard operations, such as @ or ^.

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) When member functions behave differently depending on which object performed the call, this is an example of A) chaos theory

B) virtual insubordination

C) polymorphism

D) encapsulation

E) None of these

Q2) Pointers to a base class may be assigned the address of a derived class object. A)True

B)False

Q3) When a derived class has two or more base classes, the situation is called A) multiple inheritance

B) multiplicity

C) polymorphism

D) encapsulation

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) A generic function that can work with any data type is called an exception template.

A)True

B)False

Q2) In the following code, which statement is the throw point? double divide(int numer, int denom)

{

If (denom == 0)

\(\quad\)throw "ERROR: Cannot divide by zero.\n"; else

\(\quad\)return static_cast&lt;double&gt;(numer)/denom;

}

A) if (denom == 0)

B) throw "ERROR: Cannot divide by zero.\n";

C) return static_cast&lt;double&gt;(numer)/denom;

D) There is no throw point because there is no try block.

E) None of these

Q3) The line containing a throw statement is known as the throw point.

A)True

B)False

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

Page 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) A sequence container organizes data in a sequential fashion, similar to an array.

A)True

B)False

Q2) A(n) __________ is like a pointer. It is used to access the individual data elements in a container.

A) element access operator

B) subscript indicator

C) global data finder

D) iterator

E) None of these

Q3) Select all that apply. An object of a class that overloads the function call operator is a(n)

A) call operator

B) function object

C) functor

D) overloader object

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

A)True

B)False

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

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) If the head pointer points to nullptr, this indicates

A) the list has been previously created and then destroyed

B) the list needs to be destroyed

C) there are no nodes in the list

D) the list is full and cannot accept any new nodes

E) None of these

Q2) Which type of list does not contain a null pointer at the end of the list?

A) backwards linked

B) doubly linked

C) circular linked

D) null linked

E) None of these

Q3) When you create a linked list you must know in advance how many nodes the list will contain.

A)True

B)False

Q4) Nodes in a linked list are stored in contiguous memory.

A)True

B)False

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) Computer systems use stacks. For example, when a function is called, they create local variables on a stack which are removed from the stack when the function terminates.

A)True

B)False

Q2) A dynamic stack starts as an empty linked list.

A)True

B)False

Q3) The two most common queue operations are endeque and deque.

A)True

B)False

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

Q5) The STL provides containers for deque and queue.

A)True

B)False

21

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

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 recursive factorial function calculates the factorial of its parameter. Its base case is when the parameter is

A) returned

B) received

C) one

D) zero

E) None of these

Q2) Indirect recursion means that a function calls itself n number of times and then processing of the function starts from the first call.

A)True

B)False

Q3) A recursive function cannot call another function.

A)True

B)False

Q4) To solve a problem recursively, you must identify at least one case in which the problem can be solved without recursion.

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) All nodes to the right of a node hold values greater than that node's value.

A)True

B)False

Q2) A node that has no children is known as a

A) root node

B) head node

C) leaf node

D) pure binary node

E) None of these

Q3) Binary trees are commonly used to organize key values that index database records.

A)True

B)False

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

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.