From which of the following loop or conditional constructs, is "break" used for an early exit?
switch 12.0%
fo 0.0%
while 0.0%
do-while 0.0%
All of the above 87.0%
Given the following array declaration: int a[2][3][4] what would be the number of elements in array a?
24 100.0%
22 0.0%
20 0.0%
12 0.0%
36 0.0%
Given the following array: char books[][40]={ "The Little World of Don Camillo", "To Kill a Mockingbird", "My ...
m 92.0%
M 7.0%
F 0.0%
i 0.0%
L 0.0%
Given the following array: int a[8] = {1,2,3,4,5,6,7,0}; what would be the output of printf("%d",a[4]); ?
3 7.0%
4 0.0%
5 92.0%
6 0.0%
7 0.0%
Given the operators: 1) * 2) / 3) % What would be the order of precedence?
1,2,3 7.0%
1,3,2 0.0%
3,2,1 0.0%
All have the same precedence 71.0%
1 and 2 have the same precedence, 3 is of lower precedence 21.0%
Identify the incorrect statement.
Records can be defined in C by using structures 0.0%
Structure members can be of the same/different data types 0.0%
Memory is reserved when a structure label is defined 100.0%
A pointer to a structure can be used to pass a structure to a function 0.0%
Arrays of structures can be defined and initialized 0.0%
Is the following statement correct? If not, why not? If yes, what is the size of the array? int array[][3] = { {1,2}, {2,3}, {3,4,2} };
Yes, the size is three columns by two rows 0.0%
Yes, the size is two columns by two rows 0.0%
No, the first dimension is omitted 0.0%
No, one of the three initializer sets contains too many numbers 0.0%
Yes, the size is three columns by three rows 100.0%
Read the following two declaration statements. 1. #include <stdio.h> 2. #include "stdio.h" Which of the following statements pertaining to the above two statements are correct?
For statement 1, the header file will be searched first in the local directory and then in the standard system directories such as "/usr/include" 0.0%
For statement 1, the header file will be searched in the standard system directories such as "/usr/include" 45.0%
For statement 2, the header file will be searched first in the local directory and then in the standard system directories such as "/usr/include" 55.0%
For statement 2, the header file will be searched in the standard system directories such as "/usr/include" 0.0%
None of the above 0.0%
Study the following code where num is an integer array and n is the length of the array: for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { ...
It prints the elements of the array in the ascending orde 0.0%
It calculates the sum of the elements of the array 0.0%
It sorts the array in the ascending orde 100.0%
It sorts the array in the descending orde 0.0%
It calculates the average of the elements of the array 0.0%
Study the following code: int n = 2; int a[n]; What is the error in the above code?
There is no error 27.0%
The minimum limit of an array is 5 0.0%
The second statement should be placed before the first 0.0%
A constant value has to be given in place of a variable for array declaration 72.0%
Suppose there is a file a.dat which has to be opened in the read mode using the FILE pointer ptr1, what will be the correct syntax?
ptr1 = open("a.dat"); 0.0%
ptr1 = fileopen("a.dat"); 0.0%
ptr1 = fopen("a.dat","r"); 100.0%
ptr1 = open("a.dat","r"); 0.0%
ptr1 = fileopen("a.dat","r"); 0.0%
What does the argv[0] represent?
The first command line parameter has been passed to the program 0.0%
The program name 100.0%
The number of command line arguments 0.0%
None of the above 0.0%
What is the function to concatenate two strings?
strcmp() 0.0%
strcpy() 0.0%
strcat() 100.0%
strlen() 0.0%
catstr() 0.0%
What is the output of the following program ? main() { int u = 1, v = 3; printf("%d %d",u,v); funct1(&u,&v); printf(" %d %d
",u,v); } void funct1(int *pu, int *pv) { *pu=0; *pv=0; re...
1 3 1 3 0.0%
1 3 1 1 0.0%
1 3 0 0 100.0%
1 1 1 1 0.0%
3 1 3 1 0.0%
What is wrong with the following statement? int func();
The function definition {...} is missing 0.0%
While calling a function, the type int is not needed 45.0%
No parameter has been passed 0.0%
The semicolon should not be there 0.0%
There is nothing wrong with the statement 54.0%
What will be printed on the standard output as a result of the following code snippet? void func() { static int i = 1; int j = 1; i++; j++; printf("%d %d ",i,j); } vo...
2 2 2 2 2 2 0.0%
2 2 3 2 4 2 100.0%
2 2 2 3 2 4 0.0%
2 2 3 3 4 4 0.0%
None of these 0.0%
What will be printed on the standard output as a result of the following code snippet? void main() { char arr[] = {'R','A','M'}; printf("%d",strlen(arr)); }
1 0.0%
3 20.0%
4 0.0%
Cannot be determined 80.0%
What will be printed on the standard output as a result of the following code snippet? void main() { int num1 = 30, num2 = 4; float result; result = (float)(num1/num2); ...
7 0.0%
7.00 100.0%
7.000000 0.0%
7.5 0.0%
7.50 0.0%
What will be printed on the standard output as a result of the following code snippet? void main() { int i,j,k; i=4; j=30; k=0; k=j++/i++; ++k; printf("%d %d %d",i,j,k); }
5 31 8 81.0%
5 31 7 18.0%
5 31 6 0.0%
4 30 7 0.0%
What will be the output of following code? int main() { int i; i = 0; for (i = 1; i <2; i++) { i++; printf( "%d", i ); continue; ...
22 0.0%
2,2 0.0%
2 88.0%
none of the above 11.0%
What will be the output of the following program? #include <assert.h> main() { int n = 5; assert(n > 3); //statement 1 n = n+2; assert(n > 7);//statement 2 return 0; }
Assertion 'n > 3' failed; Program aborts at statement 1 0.0%
Assertion 'n > 7' failed; Program aborts at statement 2 100.0%
Program returns 0 with the value of n as 7 0.0%
Compilation Error 0.0%
What would be printed on the standard output as a result of the following code snippet? main() { int u = 1, v = 3; printf("%d %d",u,v); funct1(&u,&v); printf("%d %d
",u,v); } void func...
1 31 3 0.0%
1 3 1 1 0.0%
1 30 0 100.0%
1 1 1 1 0.0%
3 1 3 1 0.0%
What would be printed on the standard output as a result of the following code snippet? main() { char *pmessage = "asdfgh"; *pmessage++; printf("%s", pmessage); return 0; }
Will result in Compilation Error 0.0%
Undefined string 0.0%
sdfgh 100.0%
asdfgh 0.0%
What would be printed on the standard output as a result of the following code snippet? main() { enum {red, green, blue = 6, white}; printf("%d %d %d %d", red, green, blue, white); return 0; }
0 1 6 2 0.0%
0 1 6 7 100.0%
Will result in Compilation Error 0.0%
None of the above 0.0%
What would be printed on the standard output as a result of the following code snippet? main() { int arr[10]; int a = sizeof(arr); printf("%d
",a); return 0; }
Compilation Error 0.0%
10 10.0%
4 0.0%
40 90.0%
What would be printed on the standard output as a result of the following code snippet? #define func(t, a, b) { t temp; temp=a; a=b; b=temp; } main() { int a=3, b=4; float c=4.5, d...
Results in Compilation Error 0.0%
3 4 5.99 4.50 0.0%
3 4 4.50 5.99 0.0%
4 3 5.99 4.50 100.0%
None of the above 0.0%
What would be printed on the standard output as a result of the following code snippet? #define max(a, b) ((a) > (b)?(a):(b)) main() { int a=4; float b=4.5; printf("%.2f
"...
Results in Compilation Error 0.0%
Undefined value 0.0%
4.50 100.0%
4.0 0.0%
None of the above 0.0%
What would be printed on the standard output as a result of the following code snippet? #include<stdio.h> main() { unsigned char a=255; a = a+1; printf("%d",a); ret...
Undefined value 100.0%
256 0.0%
1 0.0%
-1 0.0%
What would be printed on the standard output as a result of the following code snippet? char i = 'A'; char *j; j = & i; *j = *j + 32; printf("%c",i);
An error will occur 0.0%
a 80.0%
A 10.0%
0.0%
c 10.0%
Which file header is to be included for file handling in a C program?
string.h 0.0%
file.h 0.0%
stdio.h 100.0%
stdlib.h 0.0%
ctype.h 0.0%
Which function allocates memory and initializes elements to 0?
assign() 0.0%
calloc() 100.0%
malloc() 0.0%
swab() 0.0%
allocate() 0.0%
Which function returns the current pointer position within a file?
ftell() 100.0%
fseek() 0.0%
fgetc() 0.0%
fread() 0.0%
fscanf() 0.0%
Which function will convert a string into a double precision quantity?
atoi() 0.0%
atof() 100.0%
atol() 0.0%
atan() 0.0%
acos() 0.0%
Which function will convert a string into an integer?
int() 0.0%
number() 0.0%
atoi() 100.0%
val() 0.0%
tonum() 0.0%
Which function will you use to write a formatted output to the file?
fputc() 0.0%
fputs() 0.0%
fprintf() 100.0%
fseek() 0.0%
ftell() 0.0%
Which of the following declarations of structures is/are valid? 1) struct node { int count; char *word; struct node next; ...
123 0.0%
12 0.0%
23 100.0%
2 0.0%
None of the above 0.0%
Which of the following is a function for formatting data in memory?
sprintf() 100.0%
printf() 0.0%
scanf() 0.0%
free() 0.0%
atol() 0.0%
Which of the following is not a file related function?
fgetc() 0.0%
puts() 100.0%
fputc() 0.0%
fscanf() 0.0%
fprintf() 0.0%
Which of the following is not a string function?
strlen() 0.0%
strcmp() 0.0%
strcpy() 0.0%
strrev() 10.0%
strcomp() 90.0%
Which of the following is not a valid mode for opening a file?
r 0.0%
w 0.0%
a 0.0%
+ 0.0%
i 100.0%
Which of the following sets of conversion statements may result in the loss of data?
int i; char c; i=c; c=i; 0.0%
int i; char c; c=i; i=c; 33.0%
int i; float f; i=f; f=i; 66.0%
None of the above 0.0%
Which of the following standard functions is used to close a file?
fileclose() 0.0%
closefile() 0.0%
fclose() 100.0%
Any of the above 0.0%
Which standard function is used to clear memory allocated by the malloc() function?
free 100.0%
calloc 0.0%
delete 0.0%
elease 0.0%
destroy 0.0%