

Scientific Computing with C++ Solved Exam Questions
Course Introduction
This course introduces students to the fundamental concepts and techniques of scientific computing using the C++ programming language. Emphasizing practical problem-solving skills, the course covers essential numerical methods such as solving systems of linear equations, numerical integration and differentiation, interpolation, root finding, and basic optimization algorithms. Students will develop proficiency in implementing efficient and accurate algorithms in C++, making use of libraries and data structures relevant to scientific applications. Through hands-on programming assignments and projects, students explore real-world problems in physics, engineering, and applied mathematics, gaining experience in code development, debugging, and performance optimization for scientific computations.
Recommended Textbook
C++ Programming From Problem Analysis to Program Design 6th Edition by
Available Study Resources on Quizplus 18 Chapters
899 Verified Questions
899 Flashcards
Source URL: https://quizplus.com/study-set/1103

Page 2
D.S. Malik

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/128446
Sample Questions
Q1) A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a(n) ____.
A) algorithm
B) linker
C) analysis
D) design
Answer: A
Q2) The ____________________ monitors the overall activity of the computer and provides services such as memory management, input/output activities, and storage management.
Answer: operating system
OS
Q3) Several categories of computers exist, such as ____.
A) microframe, midframe, and miniframe
B) midsize, microframe, and mainframe
C) mainsize, midsize, and microsize
D) mainframe, midsize, and micro
Answer: D
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/21709
Sample Questions
Q1) Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____.
A) alpha = 1 - beta;
B) alpha = beta - 1;
C) beta = beta - 1;
Alpha = beta;
D) alpha = beta;
Beta = beta - 1;
Answer: C
Q2) In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____.
A) one = 10.5, two = 10.5
B) one = 10.5, two = 30.6
C) one = 30.6, two = 30.6
D) one = 11, two = 31
Answer: B
Q3) The maximum number of significant digits is called the ____________________.
Answer: precision
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
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21710
Sample Questions
Q1) In the statement cin >> x;, x can be a variable or an expression.
A)True
B)False
Answer: False
Q2) What is the output of the following statements? cout << setfill('*');
Cout << "12345678901234567890" << endl
Cout << setw(5) << "18" << setw(7) << "Happy" << setw(8) << "Sleepy" << endl;
A) 12345678901234567890
***18 Happy Sleepy
B) 12345678901234567890
***18**Happy**Sleepy
C) 12345678901234567890
***18**Happy Sleepy
D) 12345678901234567890
***18**Happy Sleepy**
Answer: B
Q3) To use the manipulator setprecision, the program must include the header file
Answer: iomanip
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
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21711
Sample Questions
Q1) What does <= mean?
A) less than
B) greater than
C) less than or equal to
D) greater than or equal to
Q2) In a ____ control structure, the computer executes particular statements depending on some condition(s).
A) looping
B) repetition
C) selection
D) sequence
Q3) When one control statement is located within another, it is said to be ____.
A) blocked
B) compound
C) nested
D) closed
Q4) The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 6

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/21712
Sample Questions
Q1) When a continue statement is executed in a ____, the update statement always executes.
A) while loop
B) for loop
C) switch structure
D) do...while loop
Q2) A software ____________________ is a piece of code written on top of an existing piece of code intended to fix a bug in the original code.
Q3) What is the output of the following C++ code? int j; for (j = 10; j <= 10; j++) \(\quad\)cout << j << " "; cout << j << endl;
A) 10
B) 10 10
C) 10 11
D) 11 11
Q4) The ____________________ loop has an exit condition but no entry condition.
Q5) The function eof is a member of the data type ____________________.
Q6) The for loop body executes indefinitely if the loop condition is always
7
To view all questions and flashcards with answers, click on the resource link above.

Chapter 6: User-Defined Functions
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21713
Sample Questions
Q1) If a formal parameter is a nonconstant reference parameter, during a function call, its corresponding actual parameter must be a(n) ____________________.
Q2) What value is returned by the following return statement? int x = 5;
Return x + 1;
A) 0
B) 5
C) 6
D) 7
Q3) A variable listed in a header is known as a(n) ____ parameter.
A) actual
B) local
C) formal
D) function
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) In C++, :: is called the ____________________.
8
To view all questions and flashcards with answers, click on the resource link above.

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/21714
Sample Questions
Q1) The string expression strVar.____________________ inserts all the characters of str at index pos into strVar.
Q2) A data type wherein you directly specify values in the variable declaration with no type name is called a(n) ____________________type.
Q3) The length of the string "Hello There. " is ____.
A) 11
B) 12
C) 13
D) 14
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) A function cannot return the value of an enumeration type.
A)True B)False
Q6) The length of the string "Hello There." is ____________________.
9
Q7) 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 10

Chapter 8: Arrays and Strings
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21715
Sample Questions
Q1) In C++, the null character is represented as ____.
A) '\0'
B) "\0"
C) '0'
D) "0"
Q2) A collection of a fixed number of elements (called components) arranged in n dimensions (n>=1) is called a(n) ____.
A) matrix
B) vector
C) n-dimensional array
D) parallel array
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) In the following declaration, the array gamma has ____________________ components.
int gamma[5][6][10];
Q5) The statement strlen("Marylin Stewart"); returns ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 9: Records Structs
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21716
Sample Questions
Q1) You can use the assignment statement on structs. A)True
B)False
Q2) Consider the accompanying struct definition. The statement that assigns the average of testScore and programmingScore to score is ____________________.
Q3) Consider the following struct definition: const int ARRAY_SIZE = 1000; struct listType
{ int listElem[ARRAY_SIZE]; int listLength; };
The statement that declares intList to be a struct variable of type listType is
Q4) In C++, the ____ symbol is an operator, called the member access operator. A) :(colon)
B) .(dot)
C) ,(comma)
D) $ (dollar sign)
To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 10: Classes and Data Abstraction
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/21717
Sample Questions
Q1) The word ____ at the end of the member functions in the accompanying class clockType in Figure 1 specifies that these functions cannot modify the member variables of a clockType object.
A) static
B) const
C) automatic
D) private
Q2) A program or software that uses and manipulates the objects of a class is called a(n) ____________________ of that class.
Q3) Classes were specifically designed in C++ to handle ____________________.
Q4) Consider the accompanying class definition, and the declaration: rectangleType bigRect;
Which of the following statements is correct?
A) rectangleType.print();
B) rectangl
C) bigRect.print();
D) bigRect::print();
Q5) Non-static member variables of a class are called the ____________________ variables of the class.
To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 11: Inheritance and Composition
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21718
Sample Questions
Q1) 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
Q2) The OOP terminology is influenced by the vocabulary of ____________________, the OOP language largely developed at a Xerox research center during the 1970s.
Q3) OOP implements ____.
A) UML
B) IPE
C) EIP
D) OOD
Q4) ____ is the ability to combine data, and operations on that data, in a single unit.
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Composition
Q5) In ____________________, the derived class is derived from a single base class.
To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 12: Pointers, Classes, Virtual Functions, and
Abstract Classes
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21719
Sample Questions
Q1) The C++ operator ____ is used to create dynamic variables. A) dynamic B) new C) virtual D) dereferencing
Q2) The ____________________ of a base class automatically makes the destructor of a derived class virtual.
Q3) The copy constructor automatically executes when the return value of a function is a(n) ____________________.
Q4) Given the declaration int *p; The statement p = new int[50]; dynamically allocates an array of 50 components of type int and p contains the base address of the array. A)True B)False
Q5) Once a class contains one or more pure virtual functions, then that class is called a(n) ____________________ class.
To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21720
Sample Questions
Q1) Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-defined type and objects of the built-in type.
A)True
B)False
Q2) The general syntax for the function prototype to overload the assignment operator = for a class is ____.
A) friend className& operator=(const className&);
B) className& operator=(className&);
C) string className& operator=(className&);
D) const className& operator=(const className&);
Q3) Which of the following is the syntax to declare the operator function operator[] as a member function of a class for nonconstant arrays?
A) Type& []operator(int index);
B) Type operator[](int index);
C) Type& operator[](int index);
D) Type [](int index);
Q4) To overload a(n) ____________________ operator for a class, if the operator function is a nonmember, it has one parameter.
To view all questions and flashcards with answers, click on the resource link above.
Page 16

Chapter 14: Exception Handling
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21721
Sample Questions
Q1) One of the typical ways of dealing with exceptions is to use an if statement. A)True B)False
Q2) The class ____________________ deals with the string subscript out of range error.
Q3) The statements that may generate an exception are placed in a ____ block. A) throw B) finally C) try D) catch
Q4) All derived classes of the class exception override the function ____________________ to issue their own error messages.
Q5) When an exception occurs in a program, the programmer usually has three choices: ____________________, include code in the program to recover from the exception, or log the error and continue.
Q6) Throwing an exception is typically done using the ____________________ statement.
Q7) 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 17

Chapter 15: Recursion
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21722
Sample Questions
Q1) The language of a computer, called ____________________ language, is a series of 0s and 1s.
Q2) If a function A calls a function B and function B calls function A, then function A is ____________________ recursive.
Q3) You can use a recursive algorithm to find the largest element in an array.
A)True
B)False
Q4) The rightmost bit of the binary representation of 33 is ____________________.
Q5) The ____________________ Fibonacci number in a sequence is the sum of the second and third Fibonacci numbers.
Q6) Which of the following rules should you follow to solve the Tower of Hanoi problem?
A) Only two disks can be moved at a time.
B) You can remove disks only from the first needle.
C) The removed disk must be placed on one of the needles.
D) A larger disk can be placed on top of a smaller disk.
Q7) The recursive algorithm must have one or more base cases, and the general solution must eventually be reduced to a(n) ____________________.
Q8) Recursive algorithms are implemented using ____________________ functions.
To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 16: Searching, Sorting and the Vector Type
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21723
Sample Questions
Q1) Which of the following statements declares intList to be a vector object of size 10?
A) vector intList();
B) vector<int> intList(0);
C) vector<int> intList(10);
D) vector<int> intList;
Q2) When moving array values for insertion sort, to move list[4] into list[2], first ____.
A) move list[2] to list[3]
B) delete list[2]
C) move list[4] to list[3]
D) copy list[4] into temp
Q3) In a bubble sort, the smaller elements move toward the bottom, and the larger elements move toward the top of the list.
A)True
B)False
Q4) The bubble sort makes fewer item assignments than comparisons with a list of 1000 elements.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.

Chapter 17: Linked Lists
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21724
Sample Questions
Q1) The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.
A) constructor
B) destructor
C) head pointer
D) tail pointer
Q2) Each node of a linked list must store the data as well as the ____________________ for the next node in the list
Q3) The ____________________ operator advances the iterator to the next node in the linked list.
Q4) You can use the pointer head of a linked list to traverse the list.
A)True
B)False
Q5) A linked list is a collection of components, called ____.
A) elements
B) nodes
C) members
D) pointers
Q6) In a linked list, the ____________________ operator returns the info of the current node.
Page 20
To view all questions and flashcards with answers, click on the resource link above.

Chapter 18: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/21725
Sample Questions
Q1) A(n) ____ is a list of homogenous elements in which the addition and deletion of elements occurs only at one end.
A) stack
B) queue
C) array
D) linked list
Q2) You can perform the operation ____ to remove the top element from the stack.
A) dequeue
B) top
C) pop
D) push
Q3) You can perform the add operation, called ____, to add an element onto the stack.
A) pop
B) push
C) enqueue
D) dequeue
Q4) The elements at the ____________________ of the stack have been in the stack the longest.
Q5) The operation ____________________ reinitializes a stack to an empty state.
To view all questions and flashcards with answers, click on the resource link above. Page 21