Question
int add(int a,int b)?
click below
click below
Question
Normal Size Small Size show me how
CCS7 Mod 1
Reviewer
Question | Answer |
---|---|
How many parameters are there in the function: int add(int a,int b)? | 2 |
Which of the following is NOT included in a function declaration? | Colon : |
Library functions are also known as _______ function: | Built-in |
Which of the following computes for the absolute value for int? | abs |
In order to define the absolute value of a number we should use: | abs |
Which of the following is a complete function? | int functCall (int x) {return x = x+1;} |
It refers to subprograms or procedure | Function |
In C++, arguments to functions always appear within ______________. | parenthesis |
How many minimum numbers of functions need to be present in a C++ program? | 1 |
The function that returns no value is known as | void function |
An overloaded function must have: | All of the mentioned |
If we start our function call with default arguments, then what will be the proceeding arguments? | default arguments |
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 8, int z=2) { return (x + y + z); } int main() { cout << fun(10); return 0; } | 20 |
Overloaded functions are: | Two or more functions with the same name but different number of parameters or type |
What is the output of the program? #include <iostream> using namespace std; int fun(int=0, int = 0); int main() { cout << fun(5); return 0; } int fun(int x, int y) { return (x+y); } | 5 |
What is the value that is returned in the following function? int getVolume() { int v; v = 23; if (v < 50) { return 50; } return v; } | 50 |
What is the default argument of b in the function? int sum(int a, int b=10, int c=20); | 10 |
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 0, int z) { return (x + y + z); } int main() { cout << fun(10); return 0; } | Error |
Which of the following does return a character? | char myGrade(int x) |
Which of the following does return a precision number? | double myGrade (double p, double q) |
What will you use if you do NOT intended to return value? | void |
What is the output of the following code? #include <iostream> using namespace std; void f1() { cout <<1<< endl;} int main() { f1(); return 0;} | 1 |
A function can be called from another function using its ____________ | name |
The return type of the function float divide (float a, float b)) is : | float |
It is the actual name of the function | Function name |
What are the mandatory parts of a function declaration? | Return type and function name |
What symbol is used to end a function declaration? | semicolon |
A function can return a value by calling using the keyword _____________ | return |
Which of the following doesn’t return a value? | void myPassingGrade(int x, int y) |
Two or more functions having the same name but different argument(s) are known as: | overloaded function |
Output?? #include <iostream> using namespace std; int factorial(int); int main() { int n = 4; cout << "Factorial is = " << factorial(4); return 0; } int factorial(int n) { if (n > 1) { return n*factorial(n-1); } else { return 1; } } | Factorial is = 24 |
What symbol is used to set a default parameter value? | = |
Which of the following permits function overloading in C++? | Type and number of Arguments |
In C++, variables can be passed to a function by: | All of the above |
In order to return a value from a function you must use: | return |
Where should default parameters appear in a function prototype? | To the rightmost side of the parameter list |
Which of the following function gets the ceiling of a number? | ceil |
In C++, ________________ are the building blocks of C++ programs | Functions |
It is the data type of the value the function returns. | Return Type |
A type of variable inside a function | Local |
Where does the execution of the program starts? | main function |
Check the given code: int add(int a,int b) { int add; add = a + b; return add; } What would be the returning value data type? | int |
Which of the following is NOT a proper function prototype (definition)? | func(int x) |
Which of the following is NOT a built-in function? | getScore() |
In C++, which of the following is important in a function? | Function name and return type |
What is the output of the program? #include < iostream > using namespace std; void fun(int x, int y) { x = 20; y = 10; } int main() { int x = 10; fun(x, x); cout << x; return 0; } | 10 |
What is a default return type of a function? | int |
The function returns the difference between the upper and lower targets as an integer. ______ increaseTemperature(int upper, int lower) {return upper - lower;} | int |
When two functions with the same name are defined in the same scope, the function is: | Overloaded |
What are the mandatory parts of a function declaration? | Return type, function name and parameters |
A placeholder of values passed into a function. | Parameter |
A function with no return value is _______________. | Void function |
The int max (int num1, int num2); code is a function _________________ : | Declaration |
To execute the codes of function, the user-defined function needs to be __________. | invoked |
Complete the code: _______ printGrade(double score) { if (score >= 90.0) cout << 'A'; else if (score >= 80.0) cout << 'B'; else if (score >= 70.0) cout << 'C'; else if (score >= 60.0) cout << 'D'; else cout << 'F'; } | int |
In order to use the sqrt function, we must include the _________ library | cmath |
Where does the default parameter can be placed by the user? | rightmost |
A function that calls itself is a __________ function | recursive |
Which of the following function declaration using the default argument is correct? | int foo(int x, int y =5, int z=10) |
What are the advantages of passing arguments by reference? | All of the mentioned |
What is the default argument of b in the function? int sum(int a=10, int b, int c=30); | error |
Which of the following computes for the power of a given number? | pow |
Which of the following function is used to accept user inputs? | cin |
It states that the function is a non-returning value function | void |
The main function in C++ is __________________. | int main() |
In a program you saw the following: int myFunctionTools(int x) float myFunctionTools(float x) double myFunctionTools(double x, double y) What‘s the best description of the given functions? | Functions are overloaded |
Which value will it take when both user and default values are given? | user value |
In C++, the function prototype is also known as _________________________ | function declaration |
Which if the following is a way to pass an argument in C++? | Call by Value and Call by Reference |
In C++, which of the following is TRUE? | All of the mentioned |
Which of the following computes for the square root of a number? | sqrt |
Which of the following function gets the floor of a number? | floor |
What is the output of the given program? #include < iostream > using namespace std; void mani() void mani() { cout << "hello"; } int main() { mani(); return 0; } | Error |
If the user didn’t supply a value in a function, then what value will it take? | default value |
In the following declaration, what is the return type? int myMethod(int count, double value) { return 4; } | int |
Which of the following is NOT a proper function prototype (definition)? | double func(char x) |
The return type of the function double averageCall (double, double, double) is : | double |
What will happen when we use a void in argument passing? | It will not return a value to its caller |
In order to use the round function, we must include the _________ library | cmath |
What is the output for the given program? #include <iostream> using namespace std; void f1() { cout <<1;} int main() { f1(); goto x; cout << "hello"; x: cout << "hi"; return 0;} | 1hi |
When will we use the function overloading? | Same function name but different number of arguments |
When do we define the default values for a function? | When a function is declared |
Which of the following is NOT a built-in function? | TheSum |
In C++, from which function the execution of a C++programs starts? | main() function |
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 0, int z=2) { return (x + y + z); } int main() { cout << fun(10); return 0; } | 12 |
When our function doesn’t need to return anything, it means that the parameter has a : | void |
Where does the “return statement” return the execution of the program? | caller function |
It refers to the information that can be passed to a function | Parameter |
In C++, the block of code begins and ends with: | {} |
How many parameters are there in the function: int theArea(int a,int b, int c)? | 3 |
Which of the following returns an integer? | int myRoundedGrade(int x) |
To call the function startCall() with the number 4432 and 3, what would you write in the main() function? | startCall(4432, 3); |
What is the return value of the following function: double myRewards(double x, double y)? | double |
When a parameter is passed to a function, it is called ______________. | Argument |
Which of the following is a valid function call (assuming the function exists)? | functCall(); |