A. function declaration cannot be skip argument names.
B. arguments are optional.
C. giving argument name is essential.
D. none of the above.
Function declaration can skip the argument names as they are optional in a function.
A. determines its scope.
B. determines the way it is initialized.
C. determines its length.
D. determines its definition.
The place of declaration of function or variable determines the scope of that function and variable.
A. void.
B. int.
C. float.
D. none of them.
void datatype specifies an empty set of values and it is used as the return type for functions that do not return a value.
A. may be without parameter list.
B. must have a parameter list.
C. must not have a parameter list.
D. none of these.
A function may be without any parameters, in which case, the parameter list is empty.
A. end with comma.
B. end with quotes.
C. end with a semicolon.
D. not end with semicolon.
The general form of function definition is:
type function_name(parameter list)
{
body of function
}
There is no semicolon in function definition.
A. variables.
B. values.
C. arguments.
D. data.
The parameter list is a comma separated list of variables of a function referred to as its arguments.
A. it is returning float value.
B. it is returning char value.
C. it is returning int value.
D. no type is being returned.
If no type is specified in a function , the compiler assumes that the function returns an integer value.
A. arguments.
B. variables.
C. constants.
D. tokens.
parameter list is also referred to as Arguments.
A. parameter list is empty.
B. argument list is not void.
C. type is empty.
D. type of data is to be given.
void data type specifies an empty set of values i.e. why in above function parameter list is empty.
A. Float value.
B. Integer value.
C. Char value.
D. Exial unit.
If no type is specified in a function , the compiler assumes that the function returns an integer value.
A. valid as argument names can be skipped.
B. invalid as argument names cannot be skipped.
C. may not be skipped.
D. none of these.
In function declaration, the names of the arguments are optional therefore they can be omitted.
A. Integer.
B. Character.
C. Float.
D. Any valid c++ data type.
Type specifies the type of value that the return statement of the function returns. It may be any valid C++ data type.
A. Library functions.
B. User defined functions.
C. Built-in functions.
D. none of them.
User defined functions are the functions created by a programmer.
A. user-defined functions.
B. built-in functions.
C. local functions.
D. classes.
These functions are part of standard library, which are made available by the compiler. Hence, these are library or built-in functions.
A. may be without parameter list.
B. must have a parameter list.
C. must not have a parameter list.
D. gives compiler error, if parameters are used.
The syntax of function definition is: type function-name (parameter list) { body of the function }
A. it is returning float value.
B. it is returning char value.
C. it is returning int value.
D. no type is being returned.
By default, the compiler returns an int value if no type is specified.
A. function definition.
B. function declaration.
C. function call.
D. function prototype.
The syntax of a function definition is: type function-name(parameter list) { body of the function } Here, type specifies the type of value that the return statement of the function returns.
A. float value.
B. integer value.
C. char value.
D. exial unit.
By default, the computer takes an integer value.
A. its matching value is missing in the function call statement.
B. matching value is given in the function call statement.
C. its matching value is missing in the function definition statement.
D. there is a compiler error.
Default values are specified at the time of function declaration, when there is no matching arguments in the function call.
A. user-defined functions.
B. programmer's functions.
C. compiler functions.
D. library functions.
These functions are a part of compiler package. They are a part of standard library, made available by the compiler.
A. passed in the function call statement.
B. not passed in the function call statement.
C. passed in the function definition.
D. not passed in the function declaration.
Default values are passed in the function prototype. It is useful in case a matching argument is not passed in the function call statement.
A. built-in functions.
B. user-defined functions.
C. library functions.
D. function statistics.
These functions are created by the user as per requirements of a program.
A. parameter list is empty.
B. argument list is not void.
C. type is empty.
D. type of data is to be given.
Specifying void in the function prototype, means that function takes no arguments.
A. function declaration.
B. function definition.
C. function calling.
D. function manipulation.
A function declaration tells the program about the type of the value returned by the function and the number and type of arguments.
A. parentheses.
B. braces.
C. quotation marks.
D. hypens.
parentheses ( ) are used to enclose the parameters or arguments.
A. the type of function used.
B. the type of parameters.
C. the type of value returned by the return statement of the function.
D. none of these.
Type specifies the type of value that the return statement of the function returns. It may be any valid C++ data type.
A. built by the programmer.
B. 2 Types of functions.
C. built by the program.
D. none of these.
Function are of two types:
. Built in functions are a part of the standard library made available by the compiler.
. And user defined function are created by the programmer.
A. Control is transferred back to the calling code.
B. Stays with the function.
C. Program ends.
D. Output is displayed.
Calling code refers to the code which has called the function.
A. Functions definition.
B. Function declaration.
C. Function calling.
D. Function returning.
The default values are specified at the time of function declarartion.
for example: int add(int a = 2, int b = 3);
A. its matching value is missing in the function call statement.
B. matching value is given in the function call statement.
C. its matching value is missing in the function definition statement.
D. there is a compiler error.
Default values are specified at the time of function declaration, when there is no matching arguments in the function call.
A. static.
B. extern.
C. register.
D. static.
It provides faster access,as variables are stored in CPU registers rather than in memory.
A. a pointer to any element of the array.
B. a pointer to the first element.
C. not a pointer to the array.
D. not a pointer to the first element.
Array name always points to the first element of an array.
A. -32768 to 32767
B. 0 to 65,535
C. -128 to 127
D. 0 to 255
A short integer is a data type that can represent a whole number which may take less storage, while having a smaller range, compared with a standard integer on the same machine. An unsigned short integer is either positive or zero and ranges from 0 to 65,535.
A. function definition.
B. function declaration.
C. function statistics.
D. function manipulation.
Example: int volume(int x, int y, int z); int volume(int, int, int); Both are correct. A function declaration can skip the argument names, but a function definition cannot.
A. char.
B. float.
C. int.
D. void.
It is used as the return type for functions that do not return a value.
A. variables.
B. constant arguments.
C. variables with strings.
D. arrays.
Constants have fixed values, their values can not be changed during a program run.
A. arguments.
B. variables.
C. constants.
D. tokens.
Example: int sum( int a, int b) { } Here a, and b are arguments.
A. two.
B. three.
C. four.
D. five.
There are 5 fundamental data types. These are: int, char, float, double and void.
A. anywhere in the program.
B. at the end of the subprogram.
C. before using it anywhere in the program.
D. none of these.
In C++, a function must be defined before it is used anywhere in the program.
A. the type of function used.
B. the type of parameters.
C. the type of value returned by the return statement of the function.
D. the type of functional call.
The function prototype and the function definition must have same return type, function name, and argument/parameter list.
A. determines its scope.
B. determines the way it is initialized.
C. determines its length.
D. determines its definition.
Scope determines the lifetime of a variable.
A. can appear on the left hand side of an expression.
B. can appear on the right hand side of an expression.
C. depends on the condition being met.
D. gives run time error.
A function returning reference can appear on the left hand side of an assignment statement. Example: let say min( )is a function, and a call to min(x, y)returns a reference to a or b. Here, min(x,y)=-7 is perfectly all right.
A. function declaration.
B. function definition.
C. function prototyping.
D. function call.
Function definition tells program about the type of the value returned by the function, and the number and type of arguments.
A. only integer.
B. only character.
C. only float.
D. any valid c++ data type.
By default, the computer assumes an integer value, and for the functions returning non-integer values, the type specifier must be given.
A. call by value only.
B. call by reference only.
C. call by value as well as call by reference.
D. default value.
Function call need not be purely by value, or reference. Mix of the two is also possible.
A. optional.
B. essential.
C. illegal.
D. not necessary.
Function prototyping is must in a C++ program. The syntax of function prototyping is: type function-name (parameter list);
A. global.
B. external.
C. static.
D. auto.
The auto storage-class specifier declares an automatic variable, a variable with a local lifetime.
A. extern.
B. static.
C. register.
D. auto.
auto storage-class specifier declares an automatic variable, a variable with a local lifetime.
A. structure.
B. class.
C. union.
D. reference.
Unions allow same portion of memory to be accessed as different data types, since all of them are in fact the same location in memory. The keyword union is used for declaring and creating a union.
A. empty.
B. null.
C. not empty.
D. illegal.
Variables that are not initialized contain garbage values left over from the program that last used the memory.
A. long integer constant.
B. integer constant.
C. char constant.
D. pointer constant.
L suffix indicates it is long integer constant.Example: 25 is an integer constant, whereas 25L is a long integer constant.
A. can be acessed inside a block.
B. can be accessed from any function.
C. can be accessed only from the function that declares them.
D. can be accessed inside any class.
The variables declared in the outermost block of a function have function scope.
A. exit( ).
B. return.
C. stop.
D. end.
The return has two functions: 1. Causes immediate exit from the function and return control to the operating system. 2. Used to return a value to the calling code.
A. Student;.
B. Employee;.
C. 1student;.
D. _student;.
The name of a structure follows the simple rules for a variable name. So a structure name cannot start with a digit.
A. member.
B. variable.
C. component.
D. tag.
Each instance of a structure, which is declared by the struct_name var_name; statement is called the structure variable.
A. call by reference.
B. call by value result.
C. call by reference and call by value.
D. call by value result.
A structure variable can be passed by value as well as by reference.
A. pointer operator.
B. address of operator.
C. reference operator.
D. member access operator.
- > is the member access operator to access the pointers being declared, inside a structure.
A. class.
B. conglomerate data type.
C. public class.
D. default class.
It is called as such, because it is a group of several variables under one roof.
A. b > var.
B. b- > var.
C. b.var.
D. var.b.
To access a variable of a structure the ‘.’ operator is used in the format; Structure_name.Variable_name
A. if( struct s1==struct s2)
B. struct s1{};
C. s2=s1; where both s2 and s1 belong to same data type.
D. addr address; where addr is a structure already defined.
We can not compare two structures.
A. any change made is only temporary.
B. changes are made in the original values of the variable.
C. reference to the entire structure can’t be passed.
D. changes cannot be made when reference to a structure is passed.
In call by reference, the original values get changed.
A. can’t be declared in main( ).
B. can be declared in any function.
C. can’t be passed to any function.
D. can't be returned from any function.
When a structure is defined as global, then its members also become global. Thus, they can be used by any function.
A. the members are being passed by reference.
B. the first one is being passed by value and the other by reference.
C. the members are being passed by value.
D. we cannot tell how the members are being passed.
Both are being passed by value since, no reference variable is being used.
A. structure member is being passed by value.
B. structure member is being passed by reference.
C. structure member will not be passed at all.
D. structure member will lose its value.
Here the structure variable is being passed by value. As a result, there wouldn’t be any change in the values of the structure variable.
A. of different data types.
B. of same data types.
C. which are themselves arrays.
D. which are themselves structures.
An array can never contain elements of different data types.
A. C.c;.
B. C.cc.c;.
C. cc.c;.
D. C.cc;.
Since c is a member of variable cc therefore, cc.c is used to access it.
A. 10021001
B. 10021100
C. 10011002
D. 20010012
cout will display the values of a and b, which are the members of function struct. These members are called with the help of dot operator.
A. items of the same data type.
B. related data items.
C. integers with user defined names.
D. variables.
A structure is a utility to access 2 or more interrelated variables.
A. struct foo;.
B. foo var;.
C. foo;.
D. int foo;.
A structure is declared using the struct keyword, followed by its name.
A. one.
B. none.
C. many.
D. two.
While declaring a structure without a tag, only one variable can be declared.
A. protected.
B. private.
C. public.
D. friend functions.
In structures, by default the members are public while in classes, they are private.
A. enclosed structure.
B. nested structure.
C. doubled structure.
D. single structure.
Nested structures contain structures within structures.
A. can have elements of different data type.
B. can have elements of the struct data type.
C. always have elements of the same data type.
D. can also define a structure within it.
An array wherever being declared, should contain elements of the same data type.
a) Program always begins its execution by the main( ) function.
b) This function primarily consist of function calls.
Function prototype is not needed when the function definition appears before its calling function.

A program to show that the arguments are passed by reference:
#include


Both function prototype and function definition should have must exactly have the same (i) return type (ii) function name and (iii) same argument / parameter list with same number and type in both.
When function prototype appear within the defiition of calling function, it is Known as local prototype. It is local to the block in which it appears and to the blocks which appear under that block.
In Declaration you will just declare the function with its return type, which shows that this function will be used in future. and usually declaration is done before starts the main loop.
In Definition you will define the function including its body and all statements, which does some tasks.
Many small functions in a program make it easier for ---
a)
b)
c)
Three parts of a functions are:-
i)
ii)
iii)
Advantages of using functions are:
i)
ii)
iii)
iv)
A program to explain the concept of a function is:
#include< iostream.h>
#include< conio.h>
int cube(int a);// function declaration
void main()
{
int x, result;
clrscr();
cout<<"Enter the number";
cin>> x;
result=cube(x); // calling the function
cout<<"n Cube of "<< x<<"n is n"<< result;
getch();
}
int cube(int a) // function definition
{
int compute;
compute=a*a*a;
return(compute);
}

A program to return more than one value is:
#include< iostream.h>
#include< conio.h>
void prevnext(int x, int&prev, int&next)
{
prev=x-1;
next=x+1;
}
int main()
{
int x=98, y, z;
prevnext(x,y,z);
cout<<”Previous=”<< y<<”,Next=”<< z;
getch();
return 0;
}


A. >> or ->.
B. << or period(.).
C. period(.) or ->.
D. period and {}.
We can access the structure member with the help of . or -> operator.
A. }
B. ]
C. ;
D. .
A structure is a user defined data type. The body of structure is terminated using semicolon( ;).
A. protected
B. public
C. private
D. default
Technically in C++, there is no difference between a structure and a class. By default, all members are public in a structure whereas all members are private by default in a class.
We define the function as:
Type function-name (parameter list)
{
body
The values that are passed when the function is called are called arguments or actual parameters.