July 6, 2021 in C and CPP
Define recursion.
b) Define recursion. Write a program to find an, where a is in float and n can be any
positive or negative integer. Define a recursive function power() to perform the
operation.
July 6, 2021 in C and CPP
b) Define recursion. Write a program to find an, where a is in float and n can be any
positive or negative integer. Define a recursive function power() to perform the
operation.
July 6, 2021 in C and CPP
a) Explain the structure of a ‘C’ program.
July 6, 2021 in C and CPP
A. break B. two C. one
D. static E. structure F. global
G. indirection H. type casting I. auto
J. free K. array L. fseek
M. continue N. fprintf O. malloc
P. & Q. new R. fscanf
4.1 In switch statement, one of the optional key word is ________.
4.2 ________ is used to construct user defined data type using the existing ones.
4.3 ________ is used to skip body of the loop once.
4.4 To convert one data type into another for the evaluation purpose is called ________.
4.5 In for loop, initialization is done ________ time(s).
4.6 ________ operator is used to access the value of a variable using pointer.
4.7 ________ variable can be accessed by all the functions in the program.
4.8 ________ uses a single name to represent a collection of items of same type.
4.9 Using ________ function, we can write data to file.
4.10 ________ function is used to allocate memory at run time.
July 6, 2021 in C and CPP
Each statement below is either TRUE or FALSE. Choose the most appropriate one
and ENTER in the “tear-off” sheet attached to the question paper, following
instructions therein.
2.1 By default, return type of any user-defined function is void.
2.2 In else…if ladder, the else statement at last is optional.
2.3 There must be only one main( ) function in a program.
2.4 There is only one ternary operator in ‘C’ which is Conditional operator.
2.5 int a[ ]={4}; this statement allocates 4 bytes of memory.
2.6 Float_int (float, float); is an invalid function prototype.
2.7 printf( ) is a user-defined function declared in stdio.h file.
2.8 When an array is declared, name of array works as a constant pointer to base address.
2.9 Every string ends with character ‘\&’.
2.10 If file can not be opened, fopen( ) returns Null pointer.
July 6, 2021 in C and CPP
1.10 For the following definition, which of the given option is correct?
int a[10];
A) a++;
B) a=a+1;
C) *a++;
D) *a[1];
July 6, 2021 in C and CPP
1.9 The keyword typedef is used to
A) create a type of function
B) define the type of function
C) define the type of a variable
D) create a new data type name
July 6, 2021 in C and CPP
1.8 Maximum value of an unsigned integer is
A) 65535
B) 32767
C) -32767
D) -65535
July 6, 2021 in C and CPP
1.7 Which is the correct option for the following code?
main() { char *str1="hello", *str2="hello";
if(str1==str2)
printf("equal");
else
printf("unequal"); }
A) Output is equal
B) Syntax error
C) Error because two pointers cannot be compared
D) Output is unequal
July 6, 2021 in C and CPP
1.6 What will be the output of the following code?
main() { int a,b,c;
a=1,b=10,c=2;
for( ;c<3;c++);
for( ;a<9,b>6;a++,b--)
printf(“%d”,c);
}
A) Infinite 2 2 2 ……
B) 3 3 3 3
C) 2 2 2 2
D) Infinite times 4 4 4 …
July 6, 2021 in C and CPP
1.5 What is the effect of the following code:
main() { int a[4] = {1,5};
printf(“%d”, a[3]); }
A) 0
B) Syntax error because of improper initialization
C) 5
D) Syntax error because of invalid index