0% found this document useful (0 votes)
53 views24 pages

Programming Fundamentals Final Exam Questions

The document outlines a Programming Fundamentals course that introduces students to basic programming concepts such as data types, control structures, and algorithms, emphasizing problem-solving skills. It includes details about the recommended textbook, available study resources, and sample exam questions across various chapters. By the end of the course, students will have a solid foundation for further studies in computer science and software development.

Uploaded by

v5pkqymb5d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views24 pages

Programming Fundamentals Final Exam Questions

The document outlines a Programming Fundamentals course that introduces students to basic programming concepts such as data types, control structures, and algorithms, emphasizing problem-solving skills. It includes details about the recommended textbook, available study resources, and sample exam questions across various chapters. By the end of the course, students will have a solid foundation for further studies in computer science and software development.

Uploaded by

v5pkqymb5d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Programming Fundamentals

Final Exam Questions

https://quizplus.com/study-set/319
21 Chapters
1050 Verified Questions
Programming Fundamentals
Final Exam Questions
Cou
Programming Fundamentals introduces students to the basic concepts and principles of

computer programming. This course covers essential topics such as data types,

variables, control structures (loops and conditionals), functions, and basic algorithms.

Students will learn to design, write, and debug simple programs using a modern

programming language, developing logical thinking and problem-solving skills.

Emphasis is placed on understanding the syntax and semantics of programming

constructs and applying them to solve real-world problems. By the end of the course,

students will have gained a solid foundation for further study in computer science and

software development.

Recommended Textbook
C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik

Available Study Resources on Quizplus


21 Chapters
1050 Verified Questions
1050 Flashcards
Source URL: https://quizplus.com/study-set/319

Page 2
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/128444

Sample Questions
Q1) The programming language C++ evolved from ____.
A) BASIC
B) assembly
C) C
D) C+
Answer: C

Q2) Assembly language uses easy-to-remember instructions called


____________________.
Answer: mnemonics

Q3) When you compile your program,the compiler identifies the logic errors and
suggests how to correct them.
A)True
B)False
Answer: False

Q4) When the power is switched off,everything in ____ is lost.


A) main memory
B) secondary storage
C) hard disks
D) floppy disks
Page 3
Answer: A

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

Sample Questions
Q1) ____________________ can be used to identify the authors of the program,give
the date when the program is written or modified,give a brief explanation of the
program,and explain the meaning of key statements in a program.
Answer: Comments
comments

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

Q3) The maximum number of significant digits in float values is up to 6 or 7.


A)True
B)False
Answer: True

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

Page 4
Chapter 3: Input/Output
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5306

Sample Questions
Q1) Suppose that x and y are int variables,ch is a char variable,and the input is: 4 2 A 12
Choose the values of x,y,and ch after the following statement executes:
Cin >> x >> ch >> y;
A) x = 4, ch = 2, y = 12
B) x = 4, ch = A, y = 12
C) x = 4, ch = ' ', y = 2
D) This statement results in input failure
Answer: D

Q2) To use the manipulator setprecision,the program must include the header file
____________________.
Answer: iomanip

Q3) When you want to process only partial data,you can use the stream function ____
to discard a portion of the input.
A) clear
B) skip
C) delete
D) ignore
Answer: D

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

Sample Questions
Q1) A control structure alters the normal sequential flow of execution in a program.
A)True
B)False

Q2) Which of the following is a relational operator?


A) =
B) ==
C) !
D) &&

Q3) What does <= mean?


A) less than
B) greater than
C) less than or equal to
D) greater than or equal to

Q4) Which of the following operators has the lowest precedence?


A) !
B) ||
C) &&
D) =

Q5) Every else must be paired with a(n)____________________.

Q6) A ____________________ operator


Page 6allows you to make comparisions in a
program.

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
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/128467

Sample Questions
Q1) In a sentinel-controlled while loop,the body of the loop continues to execute until the
EOF symbol is read.
A)True
B)False

Q2) 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.

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

Q4) What is the value of x after the following statements execute? int x = 5;
Int y = 30;
Do
X = x * 2;
While (x < y);
A) 5
B) 10
C) 20
D) 40

Q5) If a(n)____________________ statement is placed in a do...while structure,the


loop-continue test is evaluated immediately after this statement.

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

Page 7
Chapter 6: User-Defined Functions
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5309

Sample Questions
Q1) Given the function prototype: double testAlpha(int u,char v,double t); which of the
following statements is legal?
A) cout << testAlpha(5, 'A', 2);
B) cout << testAlpha( int 5, char 'A', int 2);
C) cout << testAlpha('5.0', 'A', '2.0');
D) cout << testAlpha(5.0, "65", 2.0);

Q2) Which statement below about prototypes and headers is true?


A) Parameter names must be listed in the prototype, but not necessarily in the header.
B) Prototypes end with a semicolon, but headers do not.
C) Headers should come before prototypes.
D) Headers end with a semicolon, but prototypes do not.

Q3) To use the predefined function tolower,the program must include the header file
____.
A) &lt;cctype&gt;
B) &lt;iostream&gt;
C) &lt;cmath&gt;
D) &lt;cstdlib&gt;

Q4) The ____________________ of an identifier refers to where in the program an


identifier is accessible (visible).

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

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

Q2) Which of the following statements declares the studentGrade variable?


A) enum studentGrade {A, B, C, D, F};
B) enum int {A, B, C, D, F} studentGrade;
C) enum studentGrade {A, B, C, D, F} grades;
D) enum grades {A, B, C, D, F} studentGrade;

Q3) Suppose str = "abcd".After the statement str = str + "ABCD"; the value of str is
"____________________".

Q4) The data type string has a named


constant,____________________,associated with it.

Q5) Before using the data type string,the program must include the header file ____.
A) enum
B) iostream
C) string
D) std

Q6) The length of the string "Hello There." is ____________________.


Page 9
Q7) No arithmetic operations are allowed on the enumeration type.
A)True
B)False
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/5311

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) The following statements store the value ____________________ into len.
int len;
len = strlen("Sunny California");

Q3) All components of an array are of the same data type.


A)True
B)False

Q4) The header file string contains the function ____________________,which


converts a value of type string to a null-terminated character array.

Q5) If an array index goes out of bounds,the program always terminates in an error.
A)True
B)False

Q6) In a(n)____________________ data type,each data item is a collection of


other data items.

Page 11
To view all questions and flashcards with answers, click on the resource link above.
Chapter 9: Records (structs)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5312

Sample Questions
Q1) The syntax for accessing a struct member is structVariableName____.
A) .memberName
B) *memberName
C) [memberName]
D) $memberName

Q2) Consider the accompanying struct definition in Figure 1.The statement that initializes
the member testScore to 95 is ____________________.

Q3) Relational operations can be used on struct variables.


A)True
B)False

Q4) A function can return a value of the type struct.


A)True
B)False

Q5) A(n)____________________ is a set of elements of the same type.

Q6) You can use an assignment statement to copy the contents of one struct into
another struct of the same type.
A)True
B)False

Q7) A struct is a(n)____________________,not a declaration.


Page 12

To view all questions and flashcards with answers, click on the resource link above.
Chapter 10: Classes and Data Abstraction
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/128469

Sample Questions
Q1) In C++,you can pass a variable by reference and still prevent the function from
changing its value by using the keyword ____ in the formal parameter declaration.
A) automatic
B) private
C) static
D) const

Q2) A(n)____________________ statement is required by any program that uses a


header class file,as well as by the implementation file that defines the operations for that
class.

Q3) If a class object is passed by ____________________,the contents of the


member variables of the actual parameter are copied into the corresponding member
variables of the formal parameter.

Q4) Classes were specifically designed in C++ to handle ____________________.

Q5) A constructor with no parameters is called the ____________________


constructor.

Q6) If a member of a class is ____,you cannot access it outside the class.


A) public
B) automatic
C) private
D) static Page 13

To view all questions and flashcards with answers, click on the resource link above.
Chapter 11: Inheritance and Composition
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5314

Sample Questions
Q1) The constructors of a derived class can (directly)initialize only the (public
data)members inherited from the base class of the derived class.
A)True
B)False

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

Q3) The preprocessor directive ____________________ is used to prevent multiple


inclusions of a header file in a program.

Q4) A call to the base class's constructor is specified in the heading of the definition of a
derived class constructor.
A)True
B)False

Q5) To define new classes in C++,you create new ____________________ files.

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

Page 14
Chapter 12: Pointers, Classes, Virtual Functions, Abstract

Classes, and Lists


Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5315

Sample Questions
Q1) What is the output of the following code?
int *p;
int x;
x = 76;
p = &x;
*p = 43;
cout << x << "," << *p << endl;
A) 76, 76
B) 76, 43
C) 43, 76
D) 43, 43

Q2) Consider the following statement: ptrMemberVarType objectThree(objectOne);


The values of the member variables of objectOne are being copied into the
corresponding member variables of objectThree.This initialization is called the ____.
A) member-wise assignment
B) default assignment
C) member-wise initialization
D) default initialization

Q3) The binding of virtual functions occurs at program ____________________


time. Page 15

Q4) The ____________________ of a list is the number of elements in the list.

To view all questions and flashcards with answers, click on the resource link above.
Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5316

Sample Questions
Q1) Using a class template,you can write a single code segment for a set of related
____.
A) classes
B) functions
C) operators
D) constructors

Q2) Class templates are called ____ types.


A) polymorphic
B) structured
C) member
D) parameterized

Q3) To overload the pre-increment (++)operator for a class,if the operator function is a
member of that class,it must have ____ parameter(s).
A) no
B) one
C) two
D) three

Q4) The ____________________ members of a class are local to the class


and,therefore,cannot be accessed outside of the class.

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

Sample Questions
Q1) The statements that may generate an exception are placed in a ____ block.
A) throw
B) finally
C) try
D) catch

Q2) If the catch block with an ellipses (in the heading)is needed,then it should be the first
catch block in a sequence of try/catch blocks.
A)True
B)False

Q3) If the operator new cannot allocate memory space,this operator throws
a(n)____________________ exception.

Q4) The general syntax to rethrow an exception caught by a catch block is: ____ (in this
case,the same exception is rethrown).
A) rethrow;
B) throw;
C) rethrow exception;
D) throw exception;

Q5) If the operator new cannot allocate memory space,this operator throws
a(n)____________________ exception.

To view all questions and flashcards withPage


answers,
17 click on the resource link above.
Chapter 15: Recursion
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5318

Sample Questions
Q1) Every call to a recursive function requires the system to allocate memory for the local
variables and formal parameters.
A)True
B)False

Q2) Recursive algorithms are implemented using ____________________


functions.

Q3) If you execute a(n)____________________ recursive function on a


computer,the function executes until the system runs out of memory.

Q4) A definition in which something is defined in terms of a smaller version of itself is


called a(n)____ definition.
A) step-wise
B) recursive
C) member-wise
D) iterative

Q5) If a function A calls function B and function B calls function A,then function A is
____________________ recursive.

Q6) Let x be an integer.We call the ____________________ of x after division by 2


the rightmost bit of x.

Q7) The ____________________ bit of 33 is 1.


Page 18

To view all questions and flashcards with answers, click on the resource link above.
Chapter 16: Linked Lists
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5319

Sample Questions
Q1) In a circular linked list with more than one node,it is convenient to make the pointer
first point to the ____________________ node of the list.

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

Q3) In a linked list,if a new item is always inserted at the beginning or at the end of the
list and the data read is unsorted,the linked list will be unsorted.
A)True
B)False

Q4) A doubly linked list can be traversed in either direction.


A)True
B)False

Q5) You can use the pointer head of a linked list to traverse the list.
A)True
B)False

Q6) In a linked list,the link component of each node is a(n)____________________.

Page 19
To view all questions and flashcards with answers, click on the resource link above.
Chapter 17: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5320

Sample Questions
Q1) In the array representation of a stack,the stack is initialized simply by setting
stackTop to ____________________.

Q2) A queue is a data structure in which the elements are ____.


A) added to the rear and deleted from the front
B) added to and deleted from the rear
C) added to and deleted from the front
D) added and deleted in the middle

Q3) A stack is a(n)____ data structure.


A) FIFO
B) FILO
C) LIFO
D) LILO

Q4) The expression a + b is the same in both infix notation and postfix notation.
A)True
B)False

Q5) In ____________________ notation,operators are written after the operands.

Q6) When describing a queuing system,we use the term ____________________


time to refer to the time it takes to serve a customer.

Q7) An array is a(n)____________________ access data structure.


Page 20

To view all questions and flashcards with answers, click on the resource link above.
Chapter 18: Searching and Sorting Algorithms
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5321

Sample Questions
Q1) The ____________________ search algorithm is the optimal worst-case
algorithm for solving search problems by using the comparison method.

Q2) For a list of length n,selection sort makes ____ item assignments.
A) n(n - 1)/2
B) 3(n - 1)
C) 3(n)
D) 4(n + 1)

Q3) A sequential search of an n-element list takes ____ key comparisons on average to
determine whether the search item is in the list.
A) 0
B) n/2
C) n
D) n<sup>2</sup>

Q4) We can trace the execution of a comparison-based algorithm by using a graph


called a ____.
A) pivot table
B) partition table
C) comparison tree
D) merge tree

To view all questions and flashcards with answers, click on the resource link above.
Page 21
Chapter 19: Binary Trees
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5322

Sample Questions
Q1) The ____________________ of a binary tree is the number of nodes on the
longest path from the root to a leaf.

Q2) In the diagram of a binary tree,an arrow is called a(n)____.


A) relation
B) path
C) directed line
D) directed branch

Q3) In a diagram of a binary tree,each node is represented as a(n)____.


A) line
B) triangle
C) circle
D) rectangle

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) In a(n)____________________ traversal,the binary tree is traversed as follows:


1.Traverse the left subtree
2.Visit the node
3.Traverse the right subtree
Page 22
To view all questions and flashcards with answers, click on the resource link above.
Chapter 20: Graphs
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5323

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) Linked lists cannot be used to implement an adjacency list.


A)True
B)False

Q3) The ____________________ algorithm gives the shortest distance for a given
node to every other node in the graph.

Q4) Let G be an undirected graph.Let u and v be two vertices in G.Then u and v are called
____ if there is an edge from one to the other.
A) adjacent
B) weighted
C) connected
D) shortest path

Q5) Let G be an undirected graph.Let u and v be two vertices in


G.A(n)____________________ in G is a simple path in which the first and last
vertices are the same.

To view all questions and flashcards withPage


answers,
23 click on the resource link above.
Chapter 21: Standard Template Library (STL)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5324

Sample Questions
Q1) Functions begin and end do not take any parameters.
A)True
B)False

Q2) The vector container stores and manages its objects in a dynamic array.
A)True
B)False

Q3) Every object in a(n)____ container has a specific position.


A) adapter
B) sequence
C) associative
D) static

Q4) The operator ____________________,supported by the stack container


class,inserts a copy of item onto the stack.

Q5) You must use the container name,the container element type,and the scope
resolution operator to use the typedef iterator.
A)True
B)False

Q6) Input iterators,with read access,step forward element by element.


A)True
B)False Page 24

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

You might also like