1. Which of the following statements should be used... 2.1 ?

advertisement
1. Which of the following statements should be used to obtain a remainder after dividing 3.14 by
2.1 ?
A.rem = 3.14 % 2.1;
B. rem = modf(3.14, 2.1);
C. rem = fmod(3.14, 2.1);
D.Remainder cannot be obtain in floating point division.
Which of the following special symbol allowed in a variable name?
A.* (asterisk)
C. - (hyphen)
B. | (pipeline)
D._ (underscore)
How would you round off a value from 1.66 to 2.0?
A.ceil(1.66)
C. roundup(1.66)
B. floor(1.66)
D.roundto(1.66)
By default a real number is treated as a
A.float
C. long double
B. double
D.far double
Which of the following is not user defined data type?
1:
struct book
{
char name[10];
float price;
int pages;
};
2 : long int l = 2.35;
3 : enum day {Sun, Mon, Tue, Wed};
A.1
C. 3
B. 2
D.Both 1 and 2
Is the following statement a declaration or definition?
extern int i;
A.Declaration
C. Function
Identify which of the following are declarations
1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);
B. Definition
D.Error
A.1
C. 1 and 3
B. 2
D.3
In the following program where is the variable a getting defined and where it is getting declared?
#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;
A.extern int a is declaration, int a = 20 is the definition
B. int a = 20 is declaration, extern int a is the definition
C. int a = 20 is definition, a is not defined
D.a is declared, a is not defined
When we mention the prototype of a function?
A.Defining
C. Prototyping
B. Declaring
D.Calling
What is the output of the program given below ?
#include<stdio.h>
int main()
{
enum status { pass, fail, atkt};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = atkt;
stud3 = fail;
printf("%d, %d, %d\n", stud1, stud2, stud3);
return 0;
}
A.0, 1, 2
C. 0, 2, 1
B. 1, 2, 3
D.1, 3, 2
What will be the output of the program in 16 bit platform (Turbo C under DOS)?
#include<stdio.h>
int main()
{
extern int i;
i = 20;
printf("%d\n", sizeof(i));
return 0;
}
A.2
B. 4
C. vary from compiler
D.Linker Error : Undefined symbol 'i'
What is the output of the program?
#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;
A.20
C. Garbage Value
B. 0
D.Error
What is the output of the program in Turbo C (in DOS 16-bit OS)?
#include<stdio.h>
int main()
{
char *s1;
char far *s2;
char huge *s3;
printf("%d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3));
return 0;
}
A.2, 4, 6
C. 2, 4, 4
B. 4, 4, 2
D.2, 2, 2
What is the output of the program
#include<stdio.h>
int main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e = {"Tiger"};
printf("%d, %f\n", e.age, e.sal);
return 0;
}
A.0, 0.000000
C. Error
What will be the output of the program?
#include<stdio.h>
int X=40;
B. Garbage values
D.None of above
int main()
{
int X=20;
printf("%d\n", X);
return 0;
}
A.20
C. Error
B. 40
D.No Output
What is the output of the program
#include<stdio.h>
int main()
{
int x = 10, y = 20, z = 5, i;
i = x < y < z;
printf("%d\n", i);
return 0;
}
A.0
C. Error
B. 1
D.None of these
What is the output of the program
#include<stdio.h>
int main()
{
extern int fun(float);
int a;
a = fun(3.14);
printf("%d\n", a);
return 0;
}
int fun(int aa)
{
return (int)++aa;
}
A.3
C. 0
E. Compile Error
What is the output of the program
B. 3.14
D.4
#include<stdio.h>
int main()
{
int a[5] = {2, 3};
printf("%d, %d, %d\n", a[2], a[3], a[4]);
return 0;
}
A.Garbage Values
C. 3, 2, 2
B. 2, 3, 3
D.0, 0, 0
10. What is the output of the program
#include<stdio.h>
int main()
{
union a
{
int i;
char ch[2];
};
union a u;
u.ch[0] = 3;
u.ch[1] = 2;
printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i);
return 0;
}
A.3, 2, 515
B. 515, 2, 3
C. 3, 2, 5
D.None of these
In the following program how long will the for loop get executed?
#include<stdio.h>
int main()
{
int i;
for(;scanf("%s", &i); printf("%d\n", i));
return 0;
}
A.The for loop would not get executed at all
B. The for loop would get executed only once
C. The for loop would get executed 5 times
D.The for loop would get executed infinite times
12. What will be the output of the program?
#include<stdio.h>
int main()
{
int X=40;
{
int X=20;
printf("%d ", X);
}
printf("%d\n", X);
return 0;
}
A.40 40
B. 20 40
C. 20
D.Error
A long double can be used if range of a double is not enough to accommodate a real number.
A.True
B.False
2. A float is 4 bytes wide, whereas a double is 8 bytes wide.
A.True
B.False
3. If the definition of the external variable occurs in the source file before its use in a particular
function, then there is no need for an extern declaration in the function.
A.True
B.False
4. Size of short integer and long integer can be verified using the sizeof() operator.
A.True
B.False
5. Range of double is -1.7e-38 to 1.7e+38
A.True
B.False
Size of short integer and long integer would vary from one platform to another.
A.True
B.False
7. Range of float id -2.25e-308 to 2.25e+308
A.True
How many times "IndiaBIX" is get printed?
B.False
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IndiaBIX");
}
return 0;
}
A.Infinite times
B. 11 times
C. 0 times
D.10 times
View Answer Online Compiler Report Discuss in Forum
2. How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
}
A.Infinite times
B. 255 times
C. 256 times
D.254 times
View Answer Online Compiler Report Discuss in Forum
3. Which of the following is not logical operator?
A.&
B. &&
C. ||
D.!
View Answer Online Compiler Report Discuss in Forum
4. In mathematics and computer programming, which is the correct order of mathematical
operators ?
A.Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction
C. Multiplication, Addition, Division, Subtraction
D.Addition, Division, Modulus, Subtraction
View Answer Online Compiler Report Discuss in Forum
5. Which of the following cannot be checked in a switch-case statement?
A.Character
B. Integer
C. Float
D.enum
What will be the output of the program?
#include<stdio.h>
int main()
{
int i=0;
for(; i<=5; i++);
printf("%d,", i);
return 0;
}
A.0, 1, 2, 3, 4, 5
B. 5
C. 1, 2, 3, 4
D.6
View Answer Online Compiler Report Discuss in Forum
2. What will be the output of the program?
#include<stdio.h>
int main()
{
char str[]="C-program";
int a = 5;
printf(a >10?"Ps\n":"%s\n", str);
return 0;
}
A.C-program
B. Ps
C. Error
D.None of above
View Answer Online Compiler Report Discuss in Forum
3. What will be the output of the program?
#include<stdio.h>
int main()
{
int a = 500, b = 100, c;
if(!a >= 400)
b = 300;
c = 200;
printf("b = %d c = %d\n", b, c);
return 0;
}
A.b = 300 c = 200
B. b = 100 c = garbage
C. b = 300 c = garbage
D.b = 100 c = 200
View Answer Online Compiler Report Discuss in Forum
4. What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int i = 65535; /* Assume 2 byte integer*/
while(i++ != 0)
printf("%d",++i);
printf("\n");
return 0;
}
A.Infinite loop
B. 0 1 2 ... 65535
C. 0 1 2 ... 32767 - 32766 -32765 -1 0
D.No output
View Answer Online Compiler Report Discuss in Forum
5. What will be the output of the program?
#include<stdio.h>
int main()
{
int x = 3;
float y = 3.0;
if(x == y)
printf("x and y are equal");
else
printf("x and y are not equal");
return 0;
}
A.x and y are equal
B. x and y are not equal
C. Unpredictable
D.No output
What will be the output of the program, if a short int is 2 bytes wide?
#include<stdio.h>
int main()
{
short int i = 0;
for(i<=5 && i>=-1; ++i; i>0)
printf("%u,", i);
return 0;
}
A.1 ... 65535
B. Expression syntax error
C. No output
D.0, 1, 2, 3, 4, 5
View Answer Online Compiler Report Discuss in Forum
7. What will be the output of the program?
#include<stdio.h>
int main()
{
char ch;
if(ch = printf(""))
printf("It matters\n");
else
printf("It doesn't matters\n");
return 0;
}
A.It matters
B. It doesn't matters
C. matters
D.No output
View Answer Online Compiler Report Discuss in Forum
8. What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int i = 65536; /* Assume 2 byte integer*/
while(i != 0)
printf("%d",++i);
printf("\n");
return 0;
}
A.Infinite loop
B. 0 1 2 ... 65535
C. 0 1 2 ... 32767 - 32766 -32765 -1 0
D.No output
View Answer Online Compiler Report Discuss in Forum
9. What will be the output of the program?
#include<stdio.h>
int main()
{
float a = 0.7;
if(0.7 > a)
printf("Hi\n");
else
printf("Hello\n");
return 0;
}
A.Hi
B. Hello
C. Hi Hello
D.None of above
View Answer Online Compiler Report Discuss in Forum
10. What will be the output of the program?
#include<stdio.h>
int main()
{
int a=0, b=1, c=3;
*((a) ? &b : &a) = a ? b : c;
printf("%d, %d, %d\n", a, b, c);
return 0;
}
A.0, 1, 3
C. 3, 1, 3
What will be the output of the program?
B. 1, 2, 3
D.1, 3, 1
#include<stdio.h>
int main()
{
int k, num = 30;
k = (num < 10) ? 100 : 200;
printf("%d\n", num);
return 0;
}
A.200
B. 30
C. 100
D.500
View Answer Online Compiler Report Discuss in Forum
12. What will be the output of the program?
#include<stdio.h>
int main()
{
int a = 300, b, c;
if(a >= 400)
b = 300;
c = 200;
printf("%d, %d, %d\n", a, b, c);
return 0;
}
A.300, 300, 200
B. Garbage, 300, 200
C. 300, Garbage, 200
D.300, 300, Garbage
View Answer Online Compiler Report Discuss in Forum
13. What will be the output of the program?
#include<stdio.h>
int main()
{
int x=1, y=1;
for(; y; printf("%d %d\n", x, y))
{
y = x++ <= 5;
}
printf("\n");
return 0;
}
21
21
31
31
41
A.
B. 4 1
51
51
61
61
70
21
22
31
33
C.
D.
41
44
51
55
View Answer Online Compiler Report Discuss in Forum
14. What will be the output of the program?
#include<stdio.h>
int main()
{
int i = 5;
while(i-- >= 0)
printf("%d,", i);
i = 5;
printf("\n");
while(i-- >= 0)
printf("%i,", i);
while(i-- >= 0)
printf("%d,", i);
return 0;
}
4, 3, 2, 1, 0, -1
A.
4, 3, 2, 1, 0, -1
5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0
C. Error
D.5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0
View Answer Online Compiler Report Discuss in Forum
15. What will be the output of the program?
#include<stdio.h>
int main()
{
int i=3;
switch(i)
{
case 1:
printf("Hello\n");
case 2:
printf("Hi\n");
case 3:
B.
continue;
default:
printf("Bye\n");
}
return 0;
}
A.Error: Misplaced continue
C. No output
What will be the output of the program?
B. Bye
D.Hello Hi
#include<stdio.h>
int main()
{
int x = 10, y = 20;
if(!(!x) && x)
printf("x = %d\n", x);
else
printf("y = %d\n", y);
return 0;
}
A.y =20
B. x = 0
C. x = 10
D.x = 1
View Answer Online Compiler Report Discuss in Forum
17. What will be the output of the program?
#include<stdio.h>
int main()
{
int i=4;
switch(i)
{
default:
printf("This
case 1:
printf("This
break;
case 2:
printf("This
break;
case 3:
printf("This
}
return 0;
}
is default\n");
is case 1\n");
is case 2\n");
is case 3\n");
This is default
This is case 3
A.
B.
This is case 1
This is default
This is case 1
C.
D.This is default
This is case 3
View Answer Online Compiler Report Discuss in Forum
18. What will be the output of the program?
#include<stdio.h>
int main()
{
int i = 1;
switch(i)
{
printf("Hello\n");
case 1:
printf("Hi\n");
break;
case 2:
printf("\nBye\n");
break;
}
return 0;
}
Hello
Hello
A.
B.
Hi
Bye
C. Hi
D.Bye
View Answer Online Compiler Report Discuss in Forum
19. What will be the output of the program?
#include<stdio.h>
int main()
{
char j=1;
while(j < 5)
{
printf("%d, ", j);
j = j+1;
}
printf("\n");
return 0;
}
A.1 2 3 ... 127
B. 1 2 3 ... 255
C. 1 2 3 ... 127 128 0 1 2 3 ... infinite times
D.1, 2, 3, 4
View Answer Online Compiler Report Discuss in Forum
20. What will be the output of the program?
#include<stdio.h>
int main()
{
int x, y, z;
x=y=z=1;
z = ++x || ++y && ++z;
printf("x=%d, y=%d, z=%d\n", x, y, z);
return 0;
}
A.x=2, y=1, z=1
B. x=2, y=2, z=1
C. x=2, y=2, z=2
D.x=1, y=2, z=1
1. A short integer is at least 16 bits wide and a long integer is at least 32 bits wide.
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
2. If scanf() is used to store a value in a char variable then along with the value a carriage
return(\r) also gets stored it.
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
3. The modulus operator cannot be used with a long double.
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
4. A char variable can store either an ASCII character or a Unicode character.
A.True
B.False
Function
1. The keyword used to transfer control from a function back to the calling function is
A.switch
B. goto
C. go back
D.return
View Answer Online Compiler Report Discuss in Forum
2. What is the notation for following functions?
1.
int f(int a, float b)
{
/* Some code */
}
2.
int f(a, b)
int a; float b;
{
/* Some code */
}
1. KR Notation
1. Pre ANSI C Notation
B.
2. ANSI Notation
2. KR Notation
1. ANSI Notation
1. ANSI Notation
C.
D.
2. KR Notation
2. Pre ANSI Notation
View Answer Online Compiler Report Discuss in Forum
A.
3. How many times the program will print "IndiaBIX" ?
#include<stdio.h>
int main()
{
printf("IndiaBIX");
main();
return 0;
}
A.Infinite times
B. 32767 times
C. 65535 times
D.Till stack doesn't overflow
1. What will be the output of the program in 16 bit platform (Turbo C under DOS)?
#include<stdio.h>
int main()
{
int fun();
int i;
i = fun();
printf("%d\n", i);
return 0;
}
int fun()
{
_AX = 1990;
}
A.Garbage value
B. 0 (Zero)
C. 1990
D.No output
View Answer Online Compiler Report Discuss in Forum
2. What will be the output of the program?
#include<stdio.h>
void fun(int*, int*);
int main()
{
int i=5, j=2;
fun(&i, &j);
printf("%d, %d", i, j);
return 0;
}
void fun(int *i, int *j)
{
*i = *i**i;
*j = *j**j;
}
A.5, 2
B. 10, 4
C. 2, 5
D.25, 4
View Answer Online Compiler Report Discuss in Forum
3. What will be the output of the program?
#include<stdio.h>
int i;
int fun();
int main()
{
while(i)
{
fun();
main();
}
printf("Hello\n");
return 0;
}
int fun()
{
printf("Hi");
}
A.Hello
B. Hi Hello
C. No output
D.Infinite loop
View Answer Online Compiler Report Discuss in Forum
4. What will be the output of the program?
#include<stdio.h>
int reverse(int);
int main()
{
int no=5;
reverse(no);
return 0;
}
int reverse(int no)
{
if(no == 0)
return 0;
else
printf("%d,", no);
reverse (no--);
}
A.Print 5, 4, 3, 2, 1
B. Print 1, 2, 3, 4, 5
C. Print 5, 4, 3, 2, 1, 0
D.Infinite loop
View Answer Online Compiler Report Discuss in Forum
5. What will be the output of the program?
#include<stdio.h>
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n > 0)
{
fun(--n);
printf("%d,", n);
fun(--n);
}
}
A.0, 2, 1, 0
C. 0, 1, 0, 2
6. What will be the output of the program?
B. 1, 1, 2, 0
D.0, 1, 2, 0
#include<stdio.h>
int sumdig(int);
int main()
{
int a, b;
a = sumdig(123);
b = sumdig(123);
printf("%d, %d\n", a, b);
return 0;
}
int sumdig(int n)
{
int s, d;
if(n!=0)
{
d = n%10;
n = n/10;
s = d+sumdig(n);
}
else
return 0;
return s;
}
A.4, 4
B. 3, 3
C. 6, 6
D.12, 12
View Answer Online Compiler Report Discuss in Forum
7. What will be the output of the program?
#include<stdio.h>
int main()
{
void fun(char*);
char a[100];
a[0] = 'A'; a[1] = 'B';
a[2] = 'C'; a[3] = 'D';
fun(&a[0]);
return 0;
}
void fun(char *a)
{
a++;
printf("%c", *a);
a++;
printf("%c", *a);
}
A.AB
B. BC
C. CD
D.No output
View Answer Online Compiler Report Discuss in Forum
8. What will be the output of the program?
#include<stdio.h>
int main()
{
int fun(int);
int i = fun(10);
printf("%d\n", --i);
return 0;
}
int fun(int i)
{
return (i++);
}
A.9
B. 10
C. 11
D.8
View Answer Online Compiler Report Discuss in Forum
9. What will be the output of the program?
#include<stdio.h>
int check (int, int);
int main()
{
int c;
c = check(10, 20);
printf("c=%d\n", c);
return 0;
}
int check(int i, int j)
{
int *p, *q;
p=&i;
q=&j;
i>=45 ? return(*p): return(*q);
}
A.Print 10
B. Print 20
C. Print 1
D.Compile error
View Answer Online Compiler Report Discuss in Forum
10. What will be the output of the program?
#include<stdio.h>
int fun(int, int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
printf("%d\n",
return 0;
}
int fun(int a, int
{
return (a==b);
}
int proc(pf p, int
{
return ((*p)(a,
}
proc(fun, 6, 6));
b)
a, int b)
b));
A.6
C. 0
11. What will be the output of the program?
B. 1
D.-1
#include<stdio.h>
int main()
{
int i=1;
if(!i)
printf("IndiaBIX,");
else
{
i=0;
printf("C-Program");
main();
}
return 0;
}
A.prints "IndiaBIX, C-Program" infinitely
B. prints "C-Program" infinetly
C. prints "C-Program, IndiaBIX" infinitely
D.Error: main() should not inside else statement
View Answer Online Compiler Report Discuss in Forum
12. What will be the output of the program?
#include<stdio.h>
int addmult(int ii, int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d %d\n", k, l);
return 0;
}
A.12 12
B. No error, No output
C. Error: Compile error
D.None of above
View Answer Online Compiler Report Discuss in Forum
13. What will be the output of the program?
#include<stdio.h>
int i;
int fun1(int);
int fun2(int);
int main()
{
extern int j;
int i=3;
fun1(i);
printf("%d,", i);
fun2(i);
printf("%d", i);
return 0;
}
int fun1(int j)
{
printf("%d,", ++j);
return 0;
}
int fun2(int i)
{
printf("%d,", ++i);
return 0;
}
int j=1;
A.3, 4, 4, 3
B. 4, 3, 4, 3
C. 3, 3, 4, 4
D.3, 4, 3, 4
View Answer Online Compiler Report Discuss in Forum
14. What will be the output of the program?
#include<stdio.h>
int func1(int);
int main()
{
int k=35;
k = func1(k=func1(k=func1(k)));
printf("k=%d\n", k);
return 0;
}
int func1(int k)
{
k++;
return k;
}
A.k=35
B. k=36
C. k=37
D.k=38
View Answer Online Compiler Report Discuss in Forum
15. What will be the output of the program?
#include<stdio.h>
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d, %d\n", k, l);
return 0;
}
int addmult(int ii, int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
A.12, 12
C. 7, 12
16. What will be the output of the program?
B. 7, 7
D.12, 7
#include<stdio.h>
int check(int);
int main()
{
int i=45, c;
c = check(i);
printf("%d\n", c);
return 0;
}
int check(int ch)
{
if(ch >= 45)
return 100;
else
return 10;
}
A.100
B. 10
C. 1
D.0
View Answer Online Compiler Report Discuss in Forum
17. If int is 2 bytes wide.What will be the output of the program?
#include <stdio.h>
void fun(char**);
int main()
{
char *argv[] = {"ab", "cd", "ef", "gh"};
fun(argv);
return 0;
}
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1];
printf("%s\n", t);
}
A.ab
B. cd
C. ef
D.gh
View Answer Online Compiler Report Discuss in Forum
18. What will be the output of the program?
#include<stdio.h>
int fun(int(*)());
int main()
{
fun(main);
printf("Hi\n");
return 0;
}
int fun(int (*p)())
{
printf("Hello ");
return 0;
}
A.Infinite loop
B. Hi
C. Hello Hi
D.Error
View Answer Online Compiler Report Discuss in Forum
19. What will be the output of the program?
#include<stdio.h>
fun(int i)
{
i++;
return i;
}
int main()
{
int fun(int);
int i=3;
fun(i=fun(fun(i)));
printf("%d\n", i);
return 0;
}
A.5
B. 4
C. Error
D.Garbage value
View Answer Online Compiler Report Discuss in Forum
20. What will be the output of the program?
#include<stdio.h>
int fun(int);
int main()
{
float k=3;
fun(k=fun(fun(k)));
printf("%f\n", k);
return 0;
}
int fun(int i)
{
i++;
return i;
}
A.5.000000
C. Garbage value
21.
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>
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. Infinite loop
D.Prints "IndiaBIx"
1. Point out the error in the program
B. 3.000000
D.4.000000
f(int a, int b)
{
int a;
a = 20;
return a;
}
A.Missing parenthesis in return statement
B. The function should be defined as int f(int a, int b)
C. Redeclaration of a
D.None of above
View Answer Online Compiler Report Discuss in Forum
2. Point out the error in the program
#include<stdio.h>
int main()
{
int f(int);
int b;
b = f(20);
printf("%d\n", b);
return 0;
}
int f(int a)
{
a > 20? return(10): return(20);
}
A.Error: Prototype declaration
B. No error
C. Error: return statement cannot be used with conditional operators
D.None of above
View Answer Online Compiler Report Discuss in Forum
3. Point out the error in the program
#include<stdio.h>
int main()
{
int a=10;
void f();
a = f();
printf("%d\n", a);
return 0;
}
void f()
{
printf("Hi");
}
A.Error: Not allowed assignment
B. Error: Doesn't print anything
C. No error
D.None of above
1. A function cannot be defined inside another function
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
2. Functions cannot return more than one value at a time
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
3. If return type for a function is not specified, it defaults to int
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
4. In C all functions except main() can be called recursively.
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
5. Functions can be called either by value or reference
A.True
B.False
6. A function may have any number of return statements each returning different values.
A.True
B.False
View Answer Online Compiler Report Discuss in Forum
7. Names of functions in two different files linked together must be unique
A.True
B.False
Array
1. 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.
View Answer Online Compiler Report Discuss in Forum
2. 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
View Answer Online Compiler Report Discuss in Forum
3. 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
1. What will be the output of the program ?
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
A.2, 1, 15
B. 1, 2, 5
C. 3, 2, 15
D.2, 3, 20
View Answer Online Compiler Report Discuss in Forum
2. What will be the output of the program ?
#include<stdio.h>
int main()
{
static int a[2][2] = {1, 2, 3, 4};
int i, j;
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i));
}
}
return 0;
}
1, 1, 1, 1
1, 2, 1, 2
2, 3, 2, 3
2, 3, 2, 3
A.
B.
3, 2, 3, 2
3, 4, 3, 4
4, 4, 4, 4
4, 2, 4, 2
1, 1, 1, 1
1, 2, 3, 4
2, 2, 2, 2
2, 3, 4, 1
C.
D.
2, 2, 2, 2
3, 4, 1, 2
3, 3, 3, 3
4, 1, 2, 3
View Answer Online Compiler Report Discuss in Forum
3. What will be the output of the program ?
#include<stdio.h>
int main()
{
void fun(int, int[]);
int arr[] = {1, 2, 3, 4};
int i;
fun(4, arr);
for(i=0; i<4; i++)
printf("%d,", arr[i]);
return 0;
}
void fun(int n, int arr[])
{
int *p=0;
int i=0;
while(i++ < n)
p = &arr[i];
*p=0;
}
A.2, 3, 4, 5
B. 1, 2, 3, 4
C. 0, 1, 2, 3
D.3, 2, 1 0
View Answer Online Compiler Report Discuss in Forum
4. What will be the output of the program ?
#include<stdio.h>
void fun(int **p);
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}
A.1
B. 2
C. 3
D.4
View Answer Online Compiler Report Discuss in Forum
5. What will be the output of the program ?
#include<stdio.h>
int main()
{
static int arr[] = {0, 1, 2, 3, 4};
int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};
int **ptr=p;
ptr++;
printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
*ptr++;
printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
*++ptr;
printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
++*ptr;
printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
return 0;
}
0, 0, 0
1, 1, 2
1, 1, 1
2, 2, 3
A.
B.
2, 2, 2
3, 3, 4
3, 3, 3
4, 4, 1
1, 1, 1
0, 1, 2
2, 2, 2
1, 2, 3
C.
D.
3, 3, 3
2, 3, 4
3, 4, 4
3, 4, 5
6. What will be the output of the program if the array begins at 65472 and each integer occupies
2 bytes?
#include<stdio.h>
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.65474, 65476
B. 65480, 65496
C. 65480, 65488
D.65474, 65488
View Answer Online Compiler Report Discuss in Forum
7. What will be the output of the program in Turb C (under DOS)?
#include<stdio.h>
int main()
{
int arr[5], i=0;
while(i<5)
arr[i]=++i;
for(i=0; i<5; i++)
printf("%d, ", arr[i]);
return 0;
}
A.1, 2, 3, 4, 5,
B. Garbage value, 1, 2, 3, 4,
C. 0, 1, 2, 3, 4,
D.2, 3, 4, 5, 6,
View Answer Online Compiler Report Discuss in Forum
8. What will be the output of the program ?
#include<stdio.h>
int main()
{
int arr[1]={10};
printf("%d\n", 0[arr]);
return 0;
}
A.1
B. 10
C. 0
D.6
View Answer Online Compiler Report Discuss in Forum
9. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}
A.65486, 65488
B. 65486, 65486
C. 65486, 65490
D.65486, 65487
View Answer Online Compiler Report Discuss in Forum
10. What will be the output of the program ?
#include<stdio.h>
int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
A.5
C. 6
B. 4
D.7
11.
What will be the output of the program if the array begins 1200 in memory?
#include<stdio.h>
int main()
{
int arr[]={2, 3, 4, 1, 6};
printf("%u, %u, %u\n", arr, &arr[0], &arr);
return 0;
}
A.1200, 1202, 1204
C. 1200, 1204, 1208
B. 1200, 1200, 1200
D.1200, 1202, 1200
1.
Which of the following is correct way to define the function fun() in the
below program?
#include<stdio.h>
int main()
{
int a[3][4];
fun(a);
return 0;
}
void fun(int p[][4])
A.{
}
void fun(int *p[][4])
C. {
}
void fun(int *p[4])
B. {
}
void fun(int *p[3][4])
D.{
}
View Answer Online Compiler Report Discuss in Forum
2. Which of the following statements mentioning the name of the array begins DOES NOT yield
the base address?
1: When array name is used with the sizeof operator.
2: When array name is operand of the & operator.
3: When array name is passed to scanf() function.
4: When array name is passed to printf() function.
A.A
B. A, B
C. B
D.B, D
View Answer Online Compiler Report Discuss in Forum
3. Which of the following statements are correct about the program below?
#include<stdio.h>
int main()
{
int size, i;
scanf("%d", &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf("%d", arr[i]);
printf("%d", arr[i]);
}
return 0;
}
A.The code is erroneous since the subscript for array used in for loop is in the range 1 to size.
B. The code is erroneous since the values of array are getting scanned through the loop.
C. The code is erroneous since the statement declaring array is invalid.
D.The code is correct and runs successfully.
View Answer Online Compiler Report Discuss in Forum
4. Which of the following statements are correct about 6 used in the program?
int num[6];
num[6]=21;
In the first statement 6 specifies a particular element, whereas in the second statement it
A.
specifies a type.
In the first statement 6 specifies a array size, whereas in the second statement it specifies a
B.
particular element of array.
In the first statement 6 specifies a particular element, whereas in the second statement it
C.
specifies a array size.
D.In both the statement 6 specifies array size.
View Answer Online Compiler Report Discuss in Forum
5. Which of the following statements are correct about an array?
1: The array int num[26]; can store 26 elements.
2: The expression num[1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num[SIZE] is allowed if SIZE is a macro.
A.1
B. 1,4
C. 2,3
D.2,4
String
1. Which of the following function sets first n characters of a string to a given character?
A.strinit()
B. strnset()
C. strset()
D.strcset()
View Answer Online Compiler Report Discuss in Forum
2. If the two strings are identical, then strcmp() function returns
A.-1
B. 1
C. 0
D.Yes
View Answer Online Compiler Report Discuss in Forum
3. How will you print \n on the screen?
A.printf("\n");
B. echo "\\n";
C. printf('\n');
D.printf("\\n");
View Answer Online Compiler Report Discuss in Forum
4. The library function used to find the last occurrence of a character in a string is
A.strnstr()
B. laststr()
C. strrchr()
D.strstr()
View Answer Online Compiler Report Discuss in Forum
5. Which of the following function is used to find the first occurrence of a given string in another
string?
A.strchr()
B. strrchr()
C. strstr()
D.strnset()
6. Which of the following function is more appropriate for reading in a multi-word string?
A.printf();
B. scanf();
C. gets();
D.puts();
View Answer Online Compiler Report Discuss in Forum
7. Which of the following function is correct that finds the length of a string?
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
A.
{
length++; s++; }
return (length);
}
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
C.
length++;
return (length);
}
int xstrlen(char s)
{
int length=0;
while(*s!='\0')
B.
length++; s++;
return (length);
}
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
D.
s++;
return (length);
}
1. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[20] = "Hello", str2[20] = " World";
printf("%s\n", strcpy(str2, strcat(str1, str2)));
return 0;
}
A.Hello
B. World
C. Hello World
D.WorldHello
View Answer Online Compiler Report Discuss in Forum
2. What will be the output of the program ?
#include<stdio.h>
int main()
{
char p[] = "%d\n";
p[1] = 'c';
printf(p, 65);
return 0;
}
A.A
B. a
C. c
D.65
View Answer Online Compiler Report Discuss in Forum
3. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
printf("%d\n", strlen("123456"));
return 0;
}
A.6
B. 12
C. 7
D.2
View Answer Online Compiler Report Discuss in Forum
4. What will be the output of the program ?
#include<stdio.h>
int main()
{
printf(5+"Good Morning\n");
return 0;
}
A.Good Morning
B. Good
C. M
D.Morning
View Answer Online Compiler Report Discuss in Forum
5. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "India\0\BIX\0";
printf("%s\n", str);
return 0;
}
A.BIX
B. India
C. India BIX
D.India\0BIX
6. What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input?
#include<stdio.h>
int main()
{
void fun();
fun();
printf("\n");
return 0;
}
void fun()
{
char c;
if((c = getchar())!= '\n')
fun();
printf("%c", c);
}
A.abc abc
B. bca
C. Infinite loop
D.cba
View Answer Online Compiler Report Discuss in Forum
7. What will be the output of the program ?
#include<stdio.h>
int main()
{
printf("India", "BIX\n");
return 0;
}
A.Error
B. India BIX
C. India
D.BIX
View Answer Online Compiler Report Discuss in Forum
8. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str[7] = "IndiaBIX";
printf("%s\n", str);
return 0;
}
A.Error
B. IndiaBIX
C. Cannot predict
D.None of above
View Answer Online Compiler Report Discuss in Forum
9. What will be the output of the program ?
#include<stdio.h>
int main()
{
char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"};
int i;
char *t;
t = names[3];
names[3] = names[4];
names[4] = t;
for(i=0; i<=4; i++)
printf("%s,", names[i]);
return 0;
}
A.Suresh, Siva, Sona, Baiju, Ritu
B. Suresh, Siva, Sona, Ritu, Baiju
C. Suresh, Siva, Baiju, Sona, Ritu
D.Suresh, Siva, Ritu, Sona, Baiju
View Answer Online Compiler Report Discuss in Forum
10. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "India\0\BIX\0";
printf("%d\n", strlen(str));
return 0;
}
A.10
C. 5
11. What will be the output of the program ?
B. 6
D.11
#include<stdio.h>
#include<string.h>
int main()
{
static char str1[] = "dills";
static char str2[20];
static char str3[] = "Daffo";
int i;
i = strcmp(strcat(str3, strcpy(str2, str1)), "Daffodills");
printf("%d\n", i);
return 0;
}
A.0
B. 1
C. 2
D.4
View Answer Online Compiler Report Discuss in Forum
12. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
static char s[] = "Hello!";
printf("%d\n", *(s+strlen(s)));
return 0;
}
A.8
B. 0
C. 16
D.Error
View Answer Online Compiler Report Discuss in Forum
13. What will be the output of the program ?
#include<stdio.h>
int main()
{
static char s[25] = "The cocaine man";
int i=0;
char ch;
ch = s[++i];
printf("%c", ch);
ch = s[i++];
printf("%c", ch);
ch = i++[s];
printf("%c", ch);
ch = ++i[s];
printf("%c", ch);
return 0;
}
A.hhe!
B. he c
C. The c
D.Hhec
View Answer Online Compiler Report Discuss in Forum
14. What will be the output of the program in 16-bit platform (Turbo C under DOS) ?
#include<stdio.h>
int main()
{
printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));
return 0;
}
A.8, 1, 4
B. 4, 2, 8
C. 4, 2, 4
D.10, 3, 4
View Answer Online Compiler Report Discuss in Forum
15. What will be the output of the program ?
#include<stdio.h>
int main()
{
int i;
char a[] = "\0";
if(printf("%s", a))
printf("The string is empty\n");
else
printf("The string is not empty\n");
return 0;
}
A.The string is empty
C. No output
B. The string is not empty
D.0
16. If char=1, int=4, and float=4 bytes size, What will be the output of the program ?
#include<stdio.h>
int main()
{
char ch = 'A';
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}
A.1, 2, 4
B. 1, 4, 4
C. 2, 2, 4
D.2, 4, 8
View Answer Online Compiler Report Discuss in Forum
17. If the size of pointer is 32 bits What will be the output of the program ?
#include<stdio.h>
int main()
{
char a[] = "Visual C++";
char *b = "Visual C++";
printf("%d, %d\n", sizeof(a), sizeof(b));
printf("%d, %d", sizeof(*a), sizeof(*b));
return 0;
}
10, 2
10, 4
A.
B.
2, 2
1, 2
11, 4
12, 2
C.
D.
1, 1
2, 2
View Answer Online Compiler Report Discuss in Forum
18. What will be the output of the program ?
#include<stdio.h>
int main()
{
static char mess[6][30] = {"Don't walk in front of me...",
"I may not follow;",
"Don't walk behind me...",
"Just walk beside me...",
"And be my friend." };
printf("%c, %c\n", *(mess[2]+9), *(*(mess+2)+9));
return 0;
}
A.t, t
B. k, k
C. n, k
D.m, f
View Answer Online Compiler Report Discuss in Forum
19. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str1[] = "Hello";
char str2[10];
char *t, *s;
s = str1;
t = str2;
while(*t=*s)
*t++ = *s++;
printf("%s\n", str2);
return 0;
}
A.Hello
B. HelloHello
C. No output
D.ello
View Answer Online Compiler Report Discuss in Forum
20. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str[] = "India\0BIX\0";
printf("%d\n", sizeof(str));
return 0;
}
A.10
C. 5
21. What will be the output of the program ?
B. 6
D.11
#include<stdio.h>
int main()
{
char str[25] = "IndiaBIX";
printf("%s\n", &str+2);
return 0;
}
A.Garbage value
B. Error
C. No output
D.diaBIX
View Answer Online Compiler Report Discuss in Forum
22. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str = "IndiaBIX";
printf("%s\n", str);
return 0;
}
A.Error
B. IndiaBIX
C. Base address of str
D.No output
View Answer Online Compiler Report Discuss in Forum
23. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str[] = "Nagpur";
str[0]='K';
printf("%s, ", str);
str = "Kanpur";
printf("%s", str+1);
return 0;
}
A.Kagpur, Kanpur
B. Nagpur, Kanpur
C. Kagpur, anpur
D.Error
View Answer Online Compiler Report Discuss in Forum
24. What will be the output of the program ?
#include<stdio.h>
int main()
{
printf(5+"IndiaBIX\n");
return 0;
}
A.Error
B. IndiaBIX
C. BIX
D.None of above
View Answer Online Compiler Report Discuss in Forum
25. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
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.None of above
26. What will be the output of the program ?
#include<stdio.h>
void swap(char *, char *);
int main()
{
char *pstr[2] = {"Hello", "IndiaBIX"};
swap(pstr[0], pstr[1]);
printf("%s\n%s", pstr[0], pstr[1]);
return 0;
}
void swap(char *t1, char *t2)
{
char *t;
t=t1;
t1=t2;
t2=t;
}
IndiaBIX
A.
B. Address of "Hello" and "IndiaBIX"
Hello
Hello
Iello
C.
D.
IndiaBIX
HndiaBIX
View Answer Online Compiler Report Discuss in Forum
27. What will be the output of the program (Turbo C in 16 bit platform DOS) ?
#include<stdio.h>
#include<string.h>
int main()
{
char *str1 = "India";
char *str2 = "BIX";
char *str3;
str3 = strcat(str1, str2);
printf("%s %s\n", str3, str1);
return 0;
}
A.IndiaBIX India
B. IndiaBIX IndiaBIX
C. India India
D.Error
View Answer Online Compiler Report Discuss in Forum
28. If the size of pointer is 4 bytes then What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
printf("%d, %d", sizeof(str), strlen(str[0]));
return 0;
}
A.22, 4
B. 25, 5
C. 24, 5
D.20, 2
View Answer Online Compiler Report Discuss in Forum
29. What will be the output of the program ?
#include<stdio.h>
int main()
{
int i;
char a[] = "\0";
if(printf("%s", a))
printf("The string is not empty\n");
else
printf("The string is empty\n");
return 0;
}
A.The string is not empty
B. The string is empty
C. No output
D.0
View Answer Online Compiler Report Discuss in Forum
30. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[5], str2[5];
int i;
gets(str1);
gets(str2);
i = strcmp(str1, str2);
printf("%d\n", i);
return 0;
}
A.Unpredictable integer value
B. 0
C. -1
D.Error
31. What will be the output of the program in Turbo C?
#include<stdio.h>
int main()
{
char str[10] = "India";
str[6] = "BIX";
printf("%s\n", str);
return 0;
}
A.India BIX
B. BIX
C. India
D.Error
View Answer Online Compiler Report Discuss in Forum
32. What will be the output of the program ?
#include<stdio.h>
int main()
{
char str1[] = "Hello";
char str2[] = "Hello";
if(str1 == str2)
printf("Equal\n");
else
printf("Unequal\n");
return 0;
}
A.Equal
B. Unequal
C. Error
D.None of above
View Answer Online Compiler Report Discuss in Forum
33. What will be the output of the program ?
#include<stdio.h>
int main()
{
char t;
char *p1 = "India", *p2;
p2=p1;
p1 = "BIX";
printf("%s %s\n", p1, p2);
return 0;
}
A.India BIX
B. BIX India
C. India India
D.BIX BIX
View Answer Online Compiler Report Discuss in Forum
34. What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
printf("%c\n", "abcdefgh"[4]);
return 0;
}
A.Error
B. d
C. e
D.abcdefgh
View Answer Online Compiler Report Discuss in Forum
35. What will be the output of the following program in 16 bit platform (in Turbo C under DOS)
?
#include<stdio.h>
int main()
{
printf("%u %s\n", &"Hello", &"Hello");
return 0;
}
A.177 Hello
C. Hello Hello
B. Hello 177
D.Error
Input/Output
1. In a file contains the line "I am a boy\r\n" then on reading this line into the array str using
fgets(). What will str contain?
A."I am a boy\r\n\0"
B. "I am a boy\r\0"
C. "I am a boy\n\0"
D."I am a boy"
View Answer Online Compiler Report Discuss in Forum
2. What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");
A.open "source.txt" in binary mode for reading
B. open "source.txt" in binary mode for reading and writing
C. Create a new file "source.txt" for reading and writing
D.None of above
View Answer Online Compiler Report Discuss in Forum
3. What does fp point to in the program ?
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("trial", "r");
return 0;
}
A.The first character in the file
B. A structure which contains a char pointer which points to the first character of a file.
C. The name of the file.
D.The last character in the file.
View Answer Online Compiler Report Discuss in Forum
4. Which of the following operations can be performed on the file "NOTES.TXT" using the
below code?
FILE *fp;
fp = fopen("NOTES.TXT", "r+");
A.Reading
B. Writing
C. Appending
D.Read and Write
View Answer Online Compiler Report Discuss in Forum
5. To print out a and b given below, which of the following printf() statement will you use?
#include<stdio.h>
float a=3.14;
double b=3.14;
A.printf("%f %lf", a, b);
B. printf("%Lf %f", a, b);
C. printf("%Lf %Lf", a, b);
D.printf("%f %Lf", a, b);
6. Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main()
{
FILE *fs, *ft, *fp;
fp = fopen("A.C", "r");
fs = fopen("B.C", "r");
ft = fopen("C.C", "r");
fclose(fp, fs, ft);
return 0;
}
A."A.C" "B.C" "C.C"
B. "B.C" "C.C"
C. "A.C"
D.Error in fclose()
View Answer Online Compiler Report Discuss in Forum
7. 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<stdio.h>
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.r n
B. Trh
C. err
D.None of above
View Answer Online Compiler Report Discuss in Forum
8. To scan a and b given below, which of the following scanf() statement will you use?
#include<stdio.h>
float a;
double b;
A.scanf("%f %f", &a, &b);
B. scanf("%Lf %Lf", &a, &b);
C. scanf("%f %Lf", &a, &b);
D.scanf("%f %lf", &a, &b);
View Answer Online Compiler Report Discuss in Forum
9. Out of fgets() and gets() which function is safe to use?
A.gets()
B.fgets()
View Answer Online Compiler Report Discuss in Forum
10. Consider the following program and what will be content of t?
#include<stdio.h>
int main()
{
FILE *fp;
int t;
fp = fopen("DUMMY.C", "w");
t = fileno(fp);
printf("%d\n", t);
return 0;
}
A.size of "DUMMY.C" file
B. The handle associated with "DUMMY.C" file
C. Garbage value
D.Error in fileno()
Download