#include<stdio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}
A -
1, 2, 0, 1
B -
-3, 2, 0, 1
C -
-2, 3, 0, 1
D -
2, 3, 1, 1
3-
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 -
7, 7
C -
7, 12
D -
12, 7
4-
Will the following program print the message infinite number of times?
#include<stdio.h>
int *check(static int, static int);
int main()
{
int *c;
c = check(10, 20);
printf("%d\n", c);
return 0;
}
int *check(static int i, static int j)
{
int *p, *q;
p = &i;
q = &j;
if(i >= 45)
return (p);
else
return (q);
}
A -
10
B -
20
C -
Error: Non portable pointer conversion
D -
Error: cannot use static for function parameters
6-
If the size of integer is 4bytes, What will be the output of the program?
In the following program add a statement in the function fact() such that the factorial gets stored in j.
#include<stdio.h>
void fact(int*);
int main()
{
int i=5;
fact(&i);
printf("%d\n", i);
return 0;
}
void fact(int *j)
{
static int s=1;
if(*j!=0)
{
s = s**j;
*j = *j-1;
fact(j);
/* Add a statement here */
}
}
A -
j=s;
B -
*j=s;
C -
*j=&s;
D -
&j=s;
8-
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
9-
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 not empty
B -
The string is empty
C -
No output
D -
0
10-
What will be the output of the following program in 16 bit platform assuming that 1022 is memory address of the string "Hello1" (in Turbo C under DOS) ?