Question 1
#include<stdio.h>
struct st
{
int x;
static int y;
};
int main()
{
printf(\"%d\", sizeof(struct st));
return 0;
}
Question 2
struct node
{
int i;
float j;
};
struct node *s[10];
The above C declaration define \'s\' to be (GATE CS 2000)
Question 3
Choose the correct output from the options given below:
#include<stdio.h>
struct st
{
int x;
struct st next;
};
int main()
{
struct st temp;
temp.x = 10;
temp.next = temp;
printf(\"%d\", temp.next.x);
return 0;
}
Question 4
union test
{
int x;
char arr[8];
int y;
};
int main()
{
printf(\"%d\", sizeof(union test));
return 0;
}
Question 5
union test
{
int x;
char arr[4];
int y;
};
int main()
{
union test t;
t.x = 0;
t.arr[1] = \'G\';
printf(\"%s\", t.arr);
return 0;
}
Question 6
# include <iostream>
# include <string.h>
using namespace std;
struct Test
{
char str[20];
};
int main()
{
struct Test st1, st2;
strcpy(st1.str, \"GeeksQuiz\");
st2 = st1;
st1.str[0] = \'S\';
cout << st2.str;
return 0;
}
Question 7
#include<stdio.h>
struct Point
{
int x, y, z;
};
int main()
{
struct Point p1 = {.y = 0, .z = 1, .x = 2};
printf(\"%d %d %d\", p1.x, p1.y, p1.z);
return 0;
}
Question 8
/* First declaration */
struct node {
int data;
struct node * nextPtr;
};
/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;
Question 9
/* First declaration */
typedef struct node
{
int data;
struct node *nextPtr;
}* NODEPTR;
/* Second declaration */
struct node
{
int data;
struct node * nextPtr;
};
typedef struct node * NODEPTR;
Question 10
typedef struct Student
{
int rollno;
int total;
} Student;
Student s1;
struct Student s2;
There are 22 questions to complete.