click below
click below
Normal Size Small Size show me how
F1 ComProg
| Question | Answer |
|---|---|
| A placeholder of values passed into a function. | Parameter |
| In C++, the block of code begins and ends with: | {} |
| What will happen when we use a void in argument passing? | It will not return a value to its caller |
| How many minimum numbers of functions need to be present in a C++ program? | 1 |
| How many parameters are there in the function: int add(int a,int b)? | 2 |
| Which of the following is a valid function call (assuming the function exists)? | functCall(); |
| Which of the following is NOT a built-in function? | TheSum |
| The return type of the function double averageCall (double, double, double) is : | double |
| A function with no return value is _______________. | Void function |
| In C++, which of the following is TRUE? | Function can have no argument but no return value Function can have no argument but return value Functions can have no argument and no value >>All of the mentioned |
| When do we define the default values for a function? | When a function is declared |
| What would be the output of the given program? #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*factor | Factorial is = 24 |
| 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 |
| Two or more functions having the same name but different argument(s) are known as: | overloaded function |
| In C++, the function prototype is also known as _________________________ | function declaration |
| 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=2) { return (x + y + z); } int main() { cout << fun(10); return 0; } | 12 |
| In order to return a value from a function you must use: | return |
| A function can return a value by calling using the keyword _____________ | return |
| It refers to the information that can be passed to a function | Parameter |