1.
What will be the output of the program?
#include
#include
int main()
{
float n=1.54;
printf("%f, %f\n", ceil(n), floor(n));
return 0;
}
A. 
B. 
C. 
D. 
2.
What will be the output of the program?
#include
int main()
{
float d=2.25;
printf("%e,", d);
printf("%f,", d);
printf("%g,", d);
printf("%lf", d);
return 0;
}
A. 
B. 
C. 
2.250000e+000, 2.250000, 2.25, 2.250000
D. 
3.
Point out the error in the program
#include
int main()
{
int i;
#if A
printf("Enter any number:");
scanf("%d", &i);
#elif B
printf("The number is odd");
return 0;
}
A. 
Error: unexpected end of file because there is no matching #endif
B. 
C. 
D. 
4.
What will be the output of the program (Turbo C in 16-bit platform DOS)?
#include
#include
int main()
{
char *str1 = "India";
char *str2 = "BIX";
char *str3;
str3 = strcat(str1, str2);
printf("%s %s\n", str3, str1);
return 0;
}
A. 
B. 
C. 
D. 
5.
Which of the following statements correct about the below program?
#include
int main()
{
union a
{
int i;
char ch[2];
};
union a u1 = {512};
union a u2 = {0, 2};
return 0;
}
1: u2 CANNOT be initialized as shown.
2: u1 can be initialized as shown.
3: To initialize char ch[] of u2 '.' operator should be used.
4: The code causes an error 'Declaration syntax error'
A. 
B. 
C. 
D. 
6.
What will be the output of the program?
#include
int get();
int main()
{
const int x = get();
printf("%d", x);
return 0;
}
int get()
{
return 20;
}
A. 
B. 
C. 
D. 
7.
Point out the error in the program.
#include
#include
int fun(const union employee *e);
union employee
{
char name[15];
int age;
float salary;
};
const union employee e1;
int main()
{
strcpy(e1.name, "A");
fun(&e1);
printf("%s %d %f", e1.name, e1.age, e1.salary);
return 0;
}
int fun(const union employee *e)
{
strcpy((*e).name, "B");
return 0;
}
A. 
B. 
Error: cannot convert parameter 1 from 'const char[15]' to 'char *'
C. 
Error: LValue required in strcpy
D. 
8.
Point out the error in the following program.
#include
void display(int (*ff)());
int main()
{
int show();
int (*f)();
f = show;
display(f);
return 0;
}
void display(int (*ff)())
{
(*ff)();
}
int show()
{
printf("IndiaBIX");
}
A. 
Error: invalid parameter in function display()
B. 
Error: invalid function call f=show;
C. 
No error and prints "IndiaBIX"
D. 
No error and prints nothing.
9.
Point out the error, if any in the program.
#include
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}
A. 
B. 
C. 
Error: L value required for b
D. 
10.
What will be the output of the program?
#include
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d\n", w, x, y, z);
return 0;
}
A. 
B. 
C. 
D. 
11.
Macros have a local scope.
12.
Is this a correct way for NULL pointer assignment?
int i=0;
char *q=(char*)i;
13.
What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
#include
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u\n", a+1, &a+1);
return 0;
}
A. 
B. 
C. 
D. 
14.
What will be the output of the program ?
#include
#include
int main()
{
char sentence[80];
int i;
printf("Enter a line of text\n");
gets(sentence);
for(i=strlen(sentence)-1; i >=0; i--)
putchar(sentence[i]);
return 0;
}
A. 
The sentence will get printed in same order as it entered
B. 
The sentence will get printed in reverse order
C. 
Half of the sentence will get printed
D. 
15.
What will be the output of the program ?
#include
struct course
{
int courseno;
char coursename[25];
};
int main()
{
struct course c[] = { {102, "Java"},
{103, "PHP"},
{104, "DotNet"} };
printf("%d ", c[1].courseno);
printf("%s\n", (*(c+2)).coursename);
return 0;
}
A. 
B. 
C. 
D. 
16.
On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"?
#include
int main()
{
int i, fss;
char ch, source[20] = "source.txt", target[20]="target.txt", t;
FILE *fs, *ft;
fs = fopen(source, "r");
ft = fopen(target, "w");
while(1)
{
ch=getc(fs);
if(ch==EOF)
break;
else
{
fseek(fs, 4L, SEEK_CUR);
fputc(ch, ft);
}
}
return 0;
}
A. 
B. 
C. 
D. 
17.
What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3
/* sample.c */
#include
int main(int argc, char *argv[])
{
int j;
j = argv[1] + argv[2] + argv[3];
printf("%d", j);
return 0;
}
A. 
B. 
C. 
D. 
18.
What will be the output of the program?
#include
int main()
{
int x=1, y=1;
for(; y; printf("%d %d\n", x, y))
{
y = x++ <= 5;
}
printf("\n");
return 0;
}
A. 
A. 2 1
3 1
4 1
5 1
6 1
7 0
B. 
C. 
D. 
19.
Which of the following range is a valid long double (Turbo C in 16 bit DOS OS) ?
A. 
B. 
C. 
D. 
20.
What will be the output of the program?
#include
#include
int main()
{
int i=0;
i++;
if(i<=5)
{
printf("IndiaBIX");
exit(1);
main();
}
return 0;
}
A. 
Prints "IndiaBIX" 5 times
B. 
Function main() doesn't calls itself
C. 
D. 
21.
What will be the output of the program ?
#include
int main()
{
int i, a[] = {2, 4, 6, 8, 10};
change(a, 5);
for(i=0; i<=4; i++)
printf("%d, ", a[i]);
return 0;
}
void change(int *b, int n)
{
int i;
for(i=0; i *(b+1) = *(b+i)+5;
}
A. 
B. 
C. 
D. 
22.
What will be the output of the program ?
#include
int main()
{
enum status {pass, fail, absent};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = absent;
stud3 = fail;
printf("%d %d %d\n", stud1, stud2, stud3);
return 0;
}
A. 
B. 
C. 
D. 
23.
Which of the following statements are correct about the program?
#include
char *fun(unsigned int num, int base);
int main()
{
char *s;
s=fun(128, 2);
s=fun(128, 16);
printf("%s\n",s);
return 0;
}
char *fun(unsigned int num, int base)
{
static char buff[33];
char *ptr = &buff[sizeof(buff)-1];
*ptr = '\0';
do
{
*--ptr = "0123456789abcdef"[num %base];
num /=base;
}while(num!=0);
return ptr;
}
A. 
It converts a number to a given base
B. 
It converts a number to its equivalent binary.
C. 
It converts a number to its equivalent hexadecimal.
D. 
It converts a number to its equivalent octal.
24.
Point out the correct statement will let you access the elements of the array using 'p' in the following program?
#include
#include
int main()
{
int i, j;
int(*p)[3];
p = (int(*)[3])malloc(3*sizeof(*p));
return 0;
}
A. 
B. 
C. 
D. 
25.
Point out the error in the following program.
#include
#include
int main()
{
char str1[] = "Learn through IndiaBIX\0.com", str2[120];
char *p;
p = (char*) memccpy(str2, str1, 'i', strlen(str1));
*p = '\0';
printf("%s", str2);
return 0;
}
A. 
Error: in memccpy statement
B. 
Error: invalid pointer conversion
C. 
Error: invalid variable declaration
D. 
No error and prints "Learn through Indi"