Exam 6: Functions
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
When used as parameters, these types of variables allow a function to access the parameter's original argument.
(Multiple Choice)
4.9/5
(89)
Look at the following function prototype. int myFunction(double, double, double);
How many parameter variables does this function have?
(Multiple Choice)
4.9/5
(81)
It is a good programming practice to ____________ your functions by writing comments that describe what they do.
(Multiple Choice)
4.8/5
(85)
If a function is called more than once in a program, the values stored in the function's local variables do not _________ between function calls.
(Multiple Choice)
4.9/5
(93)
What is the output of the following program?
#include <iostream>
using namespace std;
void doSomething(int&);
int main()
{
int x = 2;
cout << x << endl;
doSomething(x);
cout << x << endl;
return 0;
}
void doSomething(int& num)
{
num = 0;
cout << num << endl;
}
(Multiple Choice)
4.9/5
(79)
Which line in the following program contains the header for the showDub function?
1 #include <iostream>
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }
(Multiple Choice)
4.8/5
(69)
It is not considered good programming practice to declare all of your variables globally.
(True/False)
4.9/5
(95)
This type of variable is defined inside a function and is not accessible outside the function.
(Multiple Choice)
4.7/5
(86)
When a function is called, flow of control moves to the function's prototype.
(True/False)
4.9/5
(81)
These types of arguments are passed to parameters automatically if no argument is provided in the function call.
(Multiple Choice)
4.9/5
(89)
One reason for using functions is to break programs into manageable units, or modules.
(True/False)
4.9/5
(76)
If a function does not have a prototype, default arguments may be specified in the function ___________.
(Multiple Choice)
4.9/5
(84)
This function causes a program to terminate, regardless of which function or control mechanism is executing.
(Multiple Choice)
4.8/5
(72)
Which line in the following program contains a call to the showDub function?
1 #include <iostream>
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }
(Multiple Choice)
4.7/5
(80)
A function __________ contains the statements that make up the function.
(Multiple Choice)
4.9/5
(75)
EXIT_FAILURE and __________ are named constants that may be used to indicate success or failure when the exit() function is called.
(Multiple Choice)
4.8/5
(87)
Showing 21 - 40 of 49
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)