M1 User-Defined Functions Flashcards
Which of the following function gets the floor of a number?
Group of answer choices
= floor
= Floors
= flooring
= floors
= floor
Which of the following is NOT a built-in function?
Group of answer choices
= getScore()
= pow()
= sqrt()
= abs()
= getScore()
In C++, from which function the execution of a C++programs starts?
Group of answer choices
= new() function
= start() function
= main() function
= end() function
= main() function
A function can be called from another function using its ____________.
Group of answer choices
= return type
= name
= variables
= comment
= name
What will you use if you do NOT intended to return value?
Group of answer choices
= void
= const
= static
= int
= void
A type of variable inside a function.
Group of answer choices
= Foreign
= Global
= Constant
= Local
= Local
Two or more functions having the same name but different argument(s) are known as:
Group of answer choices
= recursive function
= main function
= void function
= overloaded function
= overloaded function
When do we define the default values for a function?
Group of answer choices
= When a function is called
= When a function is planned
= When a function is declared
= When the scope of the function is over
= When a function is declared
include<iostream></iostream>
What is the output of the following code?
using namespace std;
int fun(int x = 0, int y = 0, int z)
{
return (x + y + z);
}
int main()
{
cout «_space;fun(10);
return 0;
}
Group of answer choices
= Error
= 20
= 10
= 0
= Error
An overloaded function must have:
Group of answer choices
= Different return types
= Different types and/or number of arguments
= Different executable statements
= All of the mentioned
= Different types and/or number of arguments
What are the advantages of passing arguments by reference?
Group of answer choices
= Changes to parameter values within the function also affects the original arguments
= Less memory is used
= All of the mentioned
= There is need to copy parameter values
= Changes to parameter values within the function also affects the original arguments
When two functions with the same name are defined in the same scope, the function is:
Group of answer choices
= Overloaded
= Final
= Static
= Double
= Overloaded
In order to return a value from a function you must use:
Group of answer choices
= overload
= return
= parameter
= void
= return
What is the default argument of b in the function?
int sum(int a=10, int b, int c=30);
Group of answer choices
= 20
= error
= 10
= 0
= 20
How many parameters are there in the function: int add(int a,int b)?
Group of answer choices
= 2
= 4
= 3
= 1
= 2
Which of the following is NOT a proper function prototype (definition)?
Group of answer choices
= char x();
= int funct (char x, char y) ;
= double func(char x)
= void funct();
= double func(char x)
To execute the codes of function, the user-defined function needs to be __________.
Group of answer choices
= debugged
= defined
= invoked
= saved
= invoked
In C++, which of the following is TRUE?
Group of answer choices
= Functions can have no argument and no value
= All of the mentioned
= Function can have no argument but return value
= Function can have no argument but no return value
= All of the mentioned
In C++, the block of code begins and ends with:
Group of answer choices
= []
= <>
= ()
= {}
= {}
What is the return type of the function with the prototype :
int functionx (char x, char y) ;
Group of answer choices
= double
= int
= char
= boolean
= int
The function that returns no value is known as
Group of answer choices
= private function
= static
= void function
= null
= void function