Time Left - 15:00 mins
GATE CS 2021 : Data structure and programming Rapid Quiz 2 (App update required to attempt this test)
Attempt now to get your rank among 782 students!
Question 1
x – = y+1; does the same as:
Question 2
int main( )
{
int x=2,y=9;
(x&y)? printf (“True”):printf(“False”);
(x&&y)? printf (“True”) :printf(“False”);
return 0;
}
What is the output of above program?
{
int x=2,y=9;
(x&y)? printf (“True”):printf(“False”);
(x&&y)? printf (“True”) :printf(“False”);
return 0;
}
What is the output of above program?
Question 3
void f1(int p, int q)
{
int c;
c = p;p = q;q=c;
}
void f2(int *a, int *b)
{
int c;
c = *a; *a = *b; *b = c;
}
void main()
{
int a = 8, b = 9,c = 12;
f1(a, b);
f2(&a, &b);
printf("%d", c – a + b);
}
The output of the above program is
Question 4
Let p be a char pointer. Consider the following statements:
I. p[i] = *(i + p)
II. i[p] = *(p + i)
III. p + i = &(i[p])
The number of correct statements are ________
Question 5
Consider the following C code snippet:
What is the output of the following program?
What is the output of the following program?
Question 6
Consider the following declaration.
struct
{
short P[10];
union
{
short a;
float b;
long z;
} u;
} t;
Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes respectively. The memory requirements for variable ‘t’ and ‘u’ ignoring alignment considerations respectively are ___________.
struct
{
short P[10];
union
{
short a;
float b;
long z;
} u;
} t;
Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes respectively. The memory requirements for variable ‘t’ and ‘u’ ignoring alignment considerations respectively are ___________.
- 782 attempts
- 7 upvotes
- 7 comments
Dec 3GATE & PSU CS