C Programming and Problem Solving
Questions 111 to 120
111.
|
When a
function is recursively called all the automatic variables are stored in a
|
||||||||||
112.
|
What would be the
output for the following Turbo C code?
int I, A[ ] = { 1, 2, 3, 4, 5 }, *P;
P = A;
++*P;
printf(
“%d ”, *P);
P += 2;
printf(
“%d ”, *P);
|
||||||||||
113.
|
The
number of arguments for realloc( )
function is/are
|
||||||||||
114.
|
int A[4] = { 5, 6, 7, 8 };
Then
which of the following will declare a pointer variable that points to the
array in the sample declaration above?
|
||||||||||
115.
|
What
would be the correct way to cast ‘ptr’ in the code above to be a pointer to a
3 element array of function pointers with a return value of int and a single
parameter of a pointer to char?
|
||||||||||
116.
|
For the following
structure declaration, find the correct statement.
struct person {
char name[20];
int
age;
struct person lady;
};
|
||||||||||
117.
|
The
restriction with union is
|
||||||||||
118.
|
What are
the two predefined FILE pointers in C?
|
||||||||||
119.
|
Which is
the fundamental data type used to implement the enum data type?
|
||||||||||
120.
|
What would be the
output if the following program( let months.c
) is run using the following command line arguments?
months Jan
Feb Mar Apr
void main( int no,
char *m[ ] ) {
while(
no ) printf( “%s ”,
m[--no] );
}
|
Answers
111.
|
Answer : (a)
Reason : As internally an active record instance is created for every call
and that ARI is pushed on the stack.
|
112.
|
Answer : (d)
Reason : Because the precedence of operators and prefix operation.
|
113.
|
Answer : (c)
Reason : As it takes two parameters, one is the pointer to the existing
block and the second is the value for new size in integers.
|
114.
|
Answer : (b)
Reason : According to the syntax and semantics of pointers and pointers to
the arrays.
|
115.
|
Answer : (e)
Reason : According to the syntax and semantics of pointers and pointers to
the arrays.
|
116.
|
Answer : (d)
Reason : As we can not create a variable of itself as a member of the
structure, but a reference can be created to create a self referential structure.
|
117.
|
Answer : (a)
Reason : As all the members shares the same memory.
|
118.
|
Answer : (c)
Reason : As console, error and stdio are not the predefined FILE pointers.
|
119.
|
Answer : (b)
Reason : According to the definition of enum.
|
120.
|
Answer : (e)
Reason : Because of the while loop and the initial value of no is 5.
|
thank you.
ReplyDeletec++ tutorial
java tutorial