1) What will be the output of the program?
#include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; }
a. 128
b. Garbage value
c. Error
d. 0
Answer
Explanation
|
ANSWER: 128
Explanation: No explanation is available for this question!
|
|
2) What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
a. The element will be set to 0.
b. The compiler would report an error.
c. The program may crash if some important data gets overwritten.
d. The array size would appropriately grow.
Answer
Explanation
|
ANSWER: The program may crash if some important data gets overwritten.
Explanation: No explanation is available for this question!
|
|
3) What does the following declaration mean?
int (*ptr)[10];
a. ptr is array of pointers to 10 integers
b. ptr is a pointer to an array of 10 integers
c. ptr is an array of 10 integers
d. ptr is an pointer to array
Answer
Explanation
|
ANSWER: ptr is a pointer to an array of 10 integers
Explanation: No explanation is available for this question!
|
|
4) In C, if you pass an array as an argument to a function, what actually gets passed?
a. Value of elements in array
b. First element of the array
c. Base address of the array
d. Address of the last element of array
Answer
Explanation
|
ANSWER: Base address of the array
Explanation: No explanation is available for this question!
|
|
5) How will you free the allocated memory?
a. remove(var-name);
b. free(var-name);
c. delete(var-name);
d. dalloc(var-name);
Answer
Explanation
|
ANSWER: free(var-name);
Explanation: No explanation is available for this question!
|
|
6) What is the similarity between a structure, union and enumeration?
a. All of them let you define new values
b. All of them let you define new data types
c. All of them let you define new pointers
d. All of them let you define new structures
Answer
Explanation
|
ANSWER: All of them let you define new data types
Explanation: No explanation is available for this question!
|
|
7) The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
a. 128 characters
b. 256 characters
c. 67 characters
d. It may vary from one operating system to another
Answer
Explanation
|
ANSWER: It may vary from one operating system to another
Explanation: No explanation is available for this question!
|
|
8) What do the 'c' and 'v' in argv stands for?
a. 'c' means argument control 'v' means argument vector
b. 'c' means argument count 'v' means argument vertex
c. 'c' means argument count 'v' means argument vector
d. 'c' means argument configuration 'v' means argument visibility
Answer
Explanation
|
ANSWER: 'c' means argument count 'v' means argument vector
Explanation: No explanation is available for this question!
|
|
9) In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr; ptr p1, p2;
a. Integer
b. Integer pointer
c. Error in declaration
d. None of the above
Answer
Explanation
|
ANSWER: Integer pointer
Explanation: No explanation is available for this question!
|
|
10) In the following code what is 'P'?
typedef char *charp; const charp P;
a. P is a constant
b. P is a character constant
c. P is character type
d. None of the above
Answer
Explanation
|
ANSWER: P is a constant
Explanation: No explanation is available for this question!
|
|
11) What is x in the following program?
#include<stdio.h> int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; }
a. x is a pointer
b. x is an array of three pointer
c. x is an array of three function pointers
d. Error in x declaration
Answer
Explanation
|
ANSWER: x is an array of three function pointers
Explanation: No explanation is available for this question!
|
|
12) How will you free the memory allocated by the following program?
#include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() { int **p, i, j; p = (int **) malloc(MAXROW * sizeof(int*)); return 0; }
a. memfree(int p);
b. dealloc(p);
c. malloc(p, 0);
d. free(p);
Answer
Explanation
|
ANSWER: free(p);
Explanation: No explanation is available for this question!
|
|
13) Specify the 2 library functions to dynamically allocate memory?
a. malloc() and memalloc()
b. alloc() and memalloc()
c. malloc() and calloc()
d. memalloc() and faralloc()
Answer
Explanation
|
ANSWER: malloc() and calloc()
Explanation: No explanation is available for this question!
|
|
14) What do the following declaration signify?
char *arr[10];
a. arr is a array of 10 character pointers.
b. arr is a array of function pointer.
c. arr is a array of characters.
d. arr is a pointer to array of characters.
Answer
Explanation
|
ANSWER: arr is a array of 10 character pointers.
Explanation: No explanation is available for this question!
|
|
15) What do the following declaration signify?
int (*pf)();
a. pf is a pointer to function.
b. pf is a function pointer.
c. pf is a pointer to a function which return int
d. pf is a function of pointer variable.
Answer
Explanation
|
ANSWER: pf is a pointer to a function which return int
Explanation: No explanation is available for this question!
|
|
16) What will the function rewind() do?
a. Reposition the file pointer to a character reverse.
b. Reposition the file pointer stream to end of file.
c. Reposition the file pointer to begining of that line.
d. Reposition the file pointer to begining of file.
Answer
Explanation
|
ANSWER: Reposition the file pointer to begining of file.
Explanation: No explanation is available for this question!
|
|
17) Input/output function prototypes and macros are defined in which header file?
a. conio.h
b. stdlib.h
c. stdio.h
d. dos.h
Answer
Explanation
|
ANSWER: stdio.h
Explanation: No explanation is available for this question!
|
|
18) Which standard library function will you use to find the last occurance of a character in a string in C?
a. strnchar()
b. strchar()
c. strrchar()
d. strrchr()
Answer
Explanation
|
ANSWER: strrchr()
Explanation: No explanation is available for this question!
|
|
19) What is stderr?
a. standard error
b. standard error types
c. standard error streams
d. standard error definitions
Answer
Explanation
|
ANSWER: standard error streams
Explanation: No explanation is available for this question!
|
|
20) What do the following declaration signify?
char **argv;
a. argv is a pointer to pointer.
b. argv is a pointer to a char pointer.
c. argv is a function pointer.
d. argv is a member of function pointer.
Answer
Explanation
|
ANSWER: argv is a pointer to a char pointer.
Explanation: No explanation is available for this question!
|
|
21) What is the sequence for preprocessor to look for the file within <> ?
a. The predefined location then the current directory
b. The current directory then the predefined location
c. The predefined location only
d. The current directory location
Answer
Explanation
|
ANSWER: The predefined location then the current directory
Explanation: No explanation is available for this question!
|
|
22) Which directory the compiler first looks for the file when using #include?
a. Current directory where program is saved
b. C:COMPILERINCLUDE
c. S:SOURCEHEADERS
d. Both (b) and (c) simultaneously
Answer
Explanation
|
ANSWER: C:COMPILERINCLUDE
Explanation: No explanation is available for this question!
|
|
23) What would happen if you create a file stdio.h and use #include "stdio.h" ?
a. The predefined library file will be selected
b. The user-defined library file will be selected
c. Both the files will be included
d. The compiler won’t accept the program
Answer
Explanation
|
ANSWER: The user-defined library file will be selected
Explanation: No explanation is available for this question!
|
|
24) How is search done in #include and #include "somelibrary.h" according to C standard?
a. When former is used, current directory is searched and when latter is used, standard directory is searched
b. When former is used, standard directory is searched and when latter is used, current directory is searched
c. When former is used, search is done in implementation defined manner and when latter is used, current directory is searched
d. For both, search for ‘somelibrary’ is done in implementation-defined places
Answer
Explanation
|
ANSWER: For both, search for ‘somelibrary’ is done in implementation-defined places
Explanation: No explanation is available for this question!
|
|
25) Comment on the output of this C code?
#include <stdio.h> #include "test.h" #include "test.h" int main() { //some code }
a. TRUE
b. Compile time error
c. FALSE
d. Depends on the compiler
Answer
Explanation
|
ANSWER: Depends on the compiler
Explanation: No explanation is available for this question!
|
|
26) Which among the following is never possible in C when members are different in a structure and union?
//Let P be a structure //Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is less than sizeof(Q)
c. sizeof(P) is equal to sizeof(Q)
d. None of the above
Answer
Explanation
|
ANSWER: None of the above
Explanation: No explanation is available for this question!
|
|
27) Which among the following is never possible in C when members in a structure are same as that in a union?
//Let P be a structure //Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is equal to sizeof(Q)
c. sizeof(P) is less than to sizeof(Q)
d. None of the above
Answer
Explanation
|
ANSWER: sizeof(P) is less than to sizeof(Q)
Explanation: No explanation is available for this question!
|
|
28) What will be the size of the following structure?
#include <stdio.h> struct temp { int a[10]; char p; };
a. 5
b. 11
c. 41
d. 44
Answer
Explanation
|
ANSWER: 44
Explanation: No explanation is available for this question!
|
|
29) Comment on the output of following C program?
#include <stdio.h> main() { int a = 1; printf("size of a is %d, ", sizeof(++a)); printf("value of a is %d", a); };
a. size of a is 4, value of a is 1
b. size of a is 4, value of a is 2
c. size of a is 2, value of a is 2
d. None of the above
Answer
Explanation
|
ANSWER: size of a is 4, value of a is 1
Explanation: No explanation is available for this question!
|
|
30) Which among the following is right?
a. sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *)
b. sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *)
c. sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)
d. The order Depends on the compiler
Answer
Explanation
|
ANSWER: sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)
Explanation: No explanation is available for this question!
|
|