On declaring a structure 0 bytes are reserved in memory.
AnswerPoint out the error in the program?
struct emp
{
int ecode;
struct emp *e;
};
Answer
What will be the output of the program ?
#include<stdio.h>
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;
}
Answer
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;
}
Answer
The library function used to reverse a string is
AnswerWhat 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;
}
Answer
Is this a correct way for NULL pointer assignment?
int i=0;
char *q=(char*)i;
What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str;
str = "%d\n";
str++;
str++;
printf(str-2, 300);
return 0;
}
Answer
Macros have a local scope.
AnswerAre the following two statement same?
1. | a <= 20 ? (b = 30): (c = 30); |
2. | (a <=20) ? b : (c = 30); |
What will be the output of the program?
#include<stdio.h>
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;
}
Answer
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
int x = 30, y = 40;
if(x == y)
printf("x is equal to y\n");
else if(x > y)
printf("x is greater than y\n");
else if(x < y)
printf("x is less than y\n")
return 0;
}
Answer
Point out the error, if any in the program.
#include<stdio.h>
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}
Answer
Which of the following cannot be checked in a switch-case statement?
AnswerWhat will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int res;
res = (64 >>(2+1-2)) & (~(1<<2));
printf("%d\n", res);
return 0;
}
Answer
What will be the output of the program?
#define P printf("%d\n", -1^~0);
#define M(P) int main()\
{\
P\
return 0;\
}
M(P)
Answer
To scan a and b given below, which of the following scanf() statement will you use?
#include<stdio.h>
float a;
double b;
Answer
Can we have an array of bit fields?
AnswerNested unions are allowed
AnswerWhat will be the output of the program ?
#include<stdio.h>
int main()
{
union var
{
int a, b;
};
union var v;
v.a=10;
v.b=20;
printf("%d\n", v.a);
return 0;
}
Answer
© 2017 QuizBucket.org