Time Left - 15:00 mins
GATE CS 2022 : Data Structure -1
Attempt now to get your rank among 305 students!
Question 1
Consider the following C program.
# include
int main ( ) {
int m = 10;
int n, n1;
n = ++m;
n1 = m++;
n--;
--n1;
n - = nl;
printf (“%d”, n);
return 0;
}
The output of the program is ______.
# include
int main ( ) {
int m = 10;
int n, n1;
n = ++m;
n1 = m++;
n--;
--n1;
n - = nl;
printf (“%d”, n);
return 0;
}
The output of the program is ______.
Question 2
What will be the output of the following code?
#include
int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
#include
int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
Question 3
What does the following code do if the head of a singly linked list is passed as a parameter :
void ABC(struct Node **head_ref, int position)
{
if (*head_ref == NULL)
return;
struct Node* temp = *head_ref;
if (position == 0)
{
*head_ref = temp->next;
free(temp);
return;
}
for (int i=0; temp!=NULL && i<position-1; i++)
temp = temp->next;
if (temp == NULL || temp->next == NULL)
return;
struct Node *next = temp->next->next;
free(temp->next);
temp->next = next;
}
Question 4
We want to perform reversal operation on linked list. In which linked list , the time complexity of the reversal operation will be minimum :
Question 5
The postfix expression for the infix expression
(A + B *(C + D))/ (F + D * E) is
(A + B *(C + D))/ (F + D * E) is
Question 6
Which of the following is true about linked list implementation of queue?
- 305 attempts
- 1 upvote
- 4 comments
Tags :
GATE & PSU CSGeneralMay 12GATE & PSU CS