1. Which of the following can never be sent by call-by-value?
|
2. What type of initialization is needed for the segment “ptr[3] = ‘3’;” to work?
|
3. Which of the correct option for this expression?
void (*ptr)(int);
|
4. What will be the output of the code ________?
#include<stdio.h>
void m(int *p, int *q)
{
int temp = *p; *p = *q; *q = temp;
}
void main()
{
int a = 11, b = 10;
m(&a, &b);
printf("%d %d\n", a, b);
}
|
5. What will be the output of the code ________?
#include<stdio.h>
void m(int p, int q)
{
int temp = p;
p = q;
q = temp;
}
void main()
{
int a = 11, b =10;
m(a, b);
printf("%d %d\n", a, b);
}
|
6. What will be the output of the code ________?
#include<stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program\n"; //Line 2
str = ptr; //Line 3
printf("%s, %s\n", str, ptr); //Line 4
}
|
7. What will be the output of the code ________?
#include<stdio.h>
struct student
{
int no = 5;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf("Minigranth");
}
|
8. Is this declaration correct?
int* ((*x)())[2];
|
9. What will be the output of the code ________?
#include<stdio.h>
void m(int p, int q)
{
int lookup[100] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
printf("%d", lookup[3]);
}
|
10. What will be the output of the code ________?
#include<stdio.h>
typedef struct p *q;
struct p
{
int x;
char y;
q ptr;
};
int main()
{
struct p p = {1, 2, &p};
printf("%d\n", p.ptr->ptr->x);
return 0;
}
|