Can we specify a variable filed width in a scanf() format string?
AnswerThe '.' operator can be used access structure elements using a structure variable.
AnswerPoint out the error in the program?
#include<stdio.h>
#include<string.h>
void modify(struct emp*);
struct emp
{
char name[20];
int age;
};
int main()
{
struct emp e = {"Sanjay", 35};
modify(&e);
printf("%s %d", e.name, e.age);
return 0;
}
void modify(struct emp *p)
{
p ->age=p->age+2;
}
Answer
Point out the error in the program?
#include<stdio.h>
int main()
{
struct a
{
float category:5;
char scheme:4;
};
printf("size=%d", sizeof(struct a));
return 0;
}
Answer
What will be the output of the program in Turbo C (under DOS)?
#include<stdio.h>
int main()
{
struct emp
{
char *n;
int age;
};
struct emp e1 = {"Dravid", 23};
struct emp e2 = e1;
strupr(e2.n);
printf("%s\n", e1.n);
return 0;
}
Answer
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;
}
Answer
Which of the statements is correct about the program?
#include<stdio.h>
int main()
{
int arr[3][3] = {1, 2, 3, 4};
printf("%d\n", *(*(*(arr))));
return 0;
}
Answer
What will be the output of the program ?
#include<stdio.h>
int main()
{
void *vp;
char ch=74, *cp="JACK";
int j=65;
vp=&ch;
printf("%c", *(char*)vp);
vp=&j;
printf("%c", *(int*)vp);
vp=cp;
printf("%s", (char*)vp+2);
return 0;
}
Answer
What will be the output of the program ?
#include<stdio.h>
int main()
{
int x=30, *y, *z;
y=&x; /* Assume address of x is 500 and integer is 4 byte size */
z=y;
*y++=*z++;
x++;
printf("x=%d, y=%d, z=%d\n", x, y, z);
return 0;
}
Answer
How many bytes are occupied by near, far and huge pointers (DOS)?
AnswerIt is necessary that a header files should have a .h extension?
AnswerIn a function two return statements should never occur.
AnswerWhat will be the output of the program?
#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;
}
Answer
The modulus operator cannot be used with a long double.
AnswerWhat will be the output of the program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
char *i = "55.555";
int result1 = 10;
float result2 = 11.111;
result1 = result1+atoi(i);
result2 = result2+atof(i);
printf("%d, %f", result1, result2);
return 0;
}
Answer
What will be the output of the program (in Turbo C under DOS)?
#include<stdio.h>
int main()
{
char huge *near *far *ptr1;
char near *far *huge *ptr2;
char far *huge *near *ptr3;
printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3));
return 0;
}
Answer
What do the following declaration signify?
void (*cmp)();
Answer
It is necessary to call the macro va_end if va_start is called in the function.
AnswerCan I increase the size of dynamically allocated array?
AnswerWhat will be the output of the program?
#include<stdio.h>
int fun(int **ptr);
int main()
{
int i=10;
const int *ptr = &i;
fun(&ptr);
return 0;
}
int fun(int **ptr)
{
int j = 223;
int *temp = &j;
printf("Before changing ptr = %5x\n", *ptr);
const *ptr = temp;
printf("After changing ptr = %5x\n", *ptr);
return 0;
}
Answer
© 2017 QuizBucket.org