0% found this document useful (0 votes)
30 views22 pages

Programming I Exam Answer Key

The Programming I Exam Answer Key provides a comprehensive overview of an introductory programming course, covering essential topics such as algorithms, data types, control structures, and functions using languages like Python or Java. It includes sample questions and answers from various chapters, along with study resources available on Quizplus. The course aims to equip students with foundational programming skills to solve real-world problems.

Uploaded by

wyjbv5pf64
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)
30 views22 pages

Programming I Exam Answer Key

The Programming I Exam Answer Key provides a comprehensive overview of an introductory programming course, covering essential topics such as algorithms, data types, control structures, and functions using languages like Python or Java. It includes sample questions and answers from various chapters, along with study resources available on Quizplus. The course aims to equip students with foundational programming skills to solve real-world problems.

Uploaded by

wyjbv5pf64
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/ 22

Programming I Exam Answer Key

https://quizplus.com/study-set/4086
20 Chapters
862 Verified Questions
Programming I
Exam Answer Key
Cou
Programming I is an introductory course designed to familiarize students with the

foundational principles and practices of computer programming. The course covers

essential topics such as algorithms, data types, variables, control structures, functions,

and basic input/output operations, typically using a high-level programming language

like Python or Java. Through hands-on exercises and assignments, students develop

problem-solving skills, learn how to write, test, and debug simple programs, and gain an

understanding of how computers execute code. By the end of the course, students are

equipped with the skills necessary to design and implement basic software solutions to

real-world problems.

Recommended Textbook
Starting Out with C++ From Control Structures through Objects 7th Edition by Tony Gaddis

Available Study Resources on Quizplus


20 Chapters
862 Verified Questions
862 Flashcards
Source URL: https://quizplus.com/study-set/4086

Page 2
Chapter 1: Introduction to Computers and Programming
Available Study Resources on Quizplus for this Chatper
44 Verified Questions
44 Flashcards
Source URL: https://quizplus.com/quiz/81871

Sample Questions
Q1) Three primary activities of a program are:
A) Variables, Operators, and Key Words
B) Lines, Statements, and Punctuation
C) Input, Processing, and Output
D) Integer, Floating-point and Character
E) None of the above
Answer: C

Q2) Which of the following is a preprocessor directive?


A) pay = hours * rate;
B) cin >> rate;
C) // This program calculates the user's pay.
D) int main()
E) #include <iostream>
Answer: E

Q3) Pseudocode is a form of 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
56 Verified Questions
56 Flashcards
Source URL: https://quizplus.com/quiz/81872

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) The numeric data types in C++ can be broken into two general categories:
A) numbers and characters
B) singles and doubles
C) integer and floating point
D) real and unreal
E) None of the above
Answer: C

Q3) The C++ language requires that you give variables names that indicate what the
variables are used for.
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
44 Verified Questions
44 Flashcards
Source URL: https://quizplus.com/quiz/81873

Sample Questions
Q1) When the fixed manipulator is used, the value specified by the setprecision
manipulator will be the number of digits to appear after the decimal point.
A)True
B)False
Answer: True

Q2) The function, pow(x, 5.0), requires this header file.


A) cstdlib
B) cmath
C) cstring
D) iostream
E) iomanip
)
Answer: B

Q3) The statement


cout << setprecision(5) << dollars << endl;
will output $5.00 to the screen.
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
53 Verified Questions
53 Flashcards
Source URL: https://quizplus.com/quiz/81874

Sample Questions
Q1) Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1;
y= y + z;
x = x + y;
cout << "result = " << (x < y ? y : x) << endl;
A) 0
B) 1
C) 2
D) 3
E) None of these

Q2) Without this statement appearing in a switch construct, the program "falls through"
all of the statements below the one with the matching case expression.
A) break
B) exit
C) switch
D) scope
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
62 Verified Questions
62 Flashcards
Source URL: https://quizplus.com/quiz/81875

Sample Questions
Q1) You may nest while and do-while loops, but you may not nest for loops.
A)True
B)False

Q2) If you want a user to enter exactly 20 values, which loop would be the best to use?
A) do-while
B) for
C) while
D) infinite
E) None of these

Q3) What will the following code display?


int number = 6;
cout << number++ << endl;
A) 6
B) 5
C) 7
D) 0

Q4) You may not use the break statement in a nested loop.
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/81876

Sample Questions
Q1) It is not considered good programming practice to declare all of your variables
globally.
A)True
B)False

Q2) Look at the following function prototype. int myFunction(double, double, double);
How many parameter variables does this function have?
A) 1
B) 2
C) 3
D) Can't tell from the prototype

Q3) Functions are ideal for use in menu-driven programs. When a user selects a menu
item, the program can ________ the appropriate function.
A) call
B) prototype
C) define
D) declare
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
53 Verified Questions
53 Flashcards
Source URL: https://quizplus.com/quiz/81877

Sample Questions
Q1) What will the following code display? int numbers[4] = { 99, 87 };
Cout << numbers[3] << endl;
A) 87
B) 0
C) garbage
D) This code will not compile

Q2) If you leave out the size declarator in an array definition:


A) you must furnish an initialization list
B) you are not required to initialize the array elements
C) all array elements default to zero values
D) your array will contain no elements

Q3) It is __________ to pass an argument to a function that contains an individual


array element, such as numbers[3].
A) illegal in C++
B) legal in C++
C) not recommended by the ANSI committee
D) not good programming practice
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
20 Verified Questions
20 Flashcards
Source URL: https://quizplus.com/quiz/81878

Sample Questions
Q1) A(n) ________ search is more efficient than a(n) ________ search
A) character, string
B) integer, double
C) binary, linear
D) linear, binary
E) None of these

Q2) The advantage of a linear search is its ____________.


A) complexity
B) efficiency
C) simplicity
D) speed
E) None of these

Q3) 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
E) None of these

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

Page 10
Chapter 10: Characters, C++-Strings, and More About the

String Class
Available Study Resources on Quizplus for this Chatper
42 Verified Questions
42 Flashcards
Source URL: https://quizplus.com/quiz/81879

Sample Questions
Q1) What will the following code output? int *numbers = new int[5];
For (int i = 0; i <= 4; i++)
*(numbers + i) = i;
Cout << numbers[2] << endl;
A) Five memory addresses
B) 0
C) 3
D) 2
E) 1

Q2) What does the following statement do? double *num2;


A) Declares a double variable named num2.
B) Declares and initializes an pointer variable named num2.
C) Initializes a variable named *num2.
D) Declares a pointer variable named num2.
E) None of these

Q3) It is legal to subtract a pointer variable from another pointer variable.


A)True
B)False

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

Sample Questions
Q1) The isdigit function will return a true if its argument is a digit between 0 and 9.
A)True
B)False

Q2) The statement char var1 = tolower('A');


Will result in:
A) var1 storing the character value 'A' .
B) var1 storing the ASCII value for lower case 'a'.
C) A is output to the monitor.
D) a is output to the monitor.
E) None of these

Q3) The strcpy function's arguments are:


A) two C-strings
B) two addresses
C) three pointers
D) one array and one pointer
E) None of these

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


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

Sample Questions
Q1) The structure pointer operator is used to dereference a pointer to a structure, not a
pointer that is a member of a structure.
A)True
B)False

Q2) When a structure is passed _________to a function, its members are not copied.
A) by reference
B) by value
C) Neither of these

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

Q4) You may use a pointer to a structure as a


A) function parameter.
B) structure member.
C) function return type.
D) All of these.
E) 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/81882

Sample Questions
Q1) This member function reads a single character from a file.
A) read
B) get
C) put
D) input
E) None of these

Q2) File output may be formatted the same way as console screen output.
A)True
B)False

Q3) This state bit can be tested to see if the end of an input stream is encountered.
A) ios::eof
B) ios::eofbit
C) ios::failbit
D) ios::badbit
E) None of these

Q4) To write to a file, you use the file_write() function.


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

Sample Questions
Q1) This is automatically called when an object is destroyed.
A) constructor function
B) specification deallocator
C) destructor function
D) coroner function
E) None of these

Q2) Members of a class object are accessed with the


A) dot operator.
B) cin object.
C) extraction operator.
D) stream insertion operator.
E) None of these

Q3) More than one destructor function may be defined for a class.
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/81884

Sample Questions
Q1) When you overload an operator, you can change the operator's original meaning to
something entirely different.
A)True
B)False

Q2) In the following function header, FeetInches FeetInches::operator++(int)


The word (int) is known as a:
A) parameterless data type
B) incomplete argument
C) dummy parameter
D) incomplete parameter
E) None of these

Q3) When a class contains an instance of another class, it is known as


A) object overloading
B) operator overloading
C) object composition
D) dynamic composition
E) None of these

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

To view all questions and flashcards withPage 16 click on the resource link above.
answers,
Chapter 15: Inheritance, Polymorphism, and Virtual

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

Sample Questions
Q1) ____________ is commonly used to extend a class, or to give it additional
capabilities.
A) Inheritance
B) Privacy
C) The constructor
D) The destructor
E) None of these

Q2) In an inheritance situation, you may not pass arguments to a base class constructor.
A)True
B)False

Q3) _________ members of a base class are never accessible to a derived class.
A) Public
B) Private
C) Protected
D) a, b, and c
E) None of these

Q4) More than one class may be derived from a base class.
A)True
B)False
Page 17

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

Sample Questions
Q1) To handle an exception that has been thrown, a program must have a(n)
_________________.
A) throw() function
B) try/catch construct
C) fatal error
D) unrecoverable error
E) None of these

Q2) How much memory is reserved for a function template?


A) four bytes
B) eight bytes
C) two bytes
D) no memory
E) None of these

Q3) When you declare an iterator to work with a container, the compiler automatically
chooses the right type.
A)True
B)False

Q4) Using a function template requires less code than overloading a function.
A)True
Page 18
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
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/81887

Sample Questions
Q1) 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

Q2) A linked list can consist of structs, objects, or other abstract data types.
A)True
B)False

Q3) When working with a linked list, one of the basic operations you can perform is to
destroy the list.
A)True
B)False

Q4) When you create a linked list, you must know in advance how many nodes the list
will contain.
A)True
B)False

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

Sample Questions
Q1) A stack that is implemented as a linked list is known as a deque.
A)True
B)False

Q2) Endeque and deque are the two most common queue operations.
A)True
B)False

Q3) The _______ operation allows an item to be stored on a stack.


A) append
B) add
C) pop
D) push
E) None of these

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

Q5) In a static stack class, the constructor function can dynamically allocate memory for
the stack array.
A)True
B)False
Page 20
To view all questions and flashcards with answers, click on the resource link above.
Chapter 19: Recursion
Available Study Resources on Quizplus for this Chatper
21 Verified Questions
21 Flashcards
Source URL: https://quizplus.com/quiz/81889

Sample Questions
Q1) 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

Q2) Recursive algorithms are less efficient than iterative algorithms.


A)True
B)False

Q3) When a recursive function directly calls itself, this is known as direct recursion.
A)True
B)False

Q4) A recursive function that does not have a termination will eventually
A) return 0 and stop
B) return false and stop
C) cause the program to crash
D) reach the Null terminator and stop
E) None of these

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

Sample Questions
Q1) All node pointers that do not point to other nodes are set to
A) the root of the tree
B) a parent node
C) their left-most child node
D) NULL
E) None of these

Q2) The root node points to two other nodes, referred to as


A) child nodes, or children
B) parent nodes, or parents
C) binary nodes
D) subnodes
E) None of these

Q3) The head pointer, anchored at the top of a tree, is called the
A) root node
B) tree pointer
C) binary pointer
D) either a or c
E) None of these

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

Page 22

You might also like