Techno Blender
Digitally Yours.

Data Structures & C Programming – GATE CSE Previous Year Questions

0 41


Solving GATE Previous Year’s Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, which helps crack GATE with a good score. 

Data Structures & C Programming Previous Year GATE Questions help in analyzing the question pattern of a subject and marking scheme as well as it helps in time management which overall increases the score in the GATE exam. With regular practice of PYQs, candidates can easily crack GATE with a good GATE Score.

Before 2006, questions asked in GATE were mainly theoretical, but in recent years, the questions asked were multiple-choice questions with a single correct option or multiple correct options. We are looking to provide the multiple-choice questions that are asked in GATE.

Data Structures & C Programming GATE Previous Year Questions

In this article, we are mainly focusing on the Data Structures & C Programming GATE Questions that are asked in Previous Years with their solutions, and where an explanation is required, we have also provided the reason.

In Data Structures, we will deal with the following concepts. We have also provided GATE Previous Year’s Questions on these topics. Here is the list of those topics along with their links.

In C Programming, we will deal with the following concepts:

  • Arithmetic Operations
  • Conditional Statement
  • Loops
  • Array and Pointer
  • Functions

Below mentioned are the links to the C Programming PYQ’s pages. On each page, you will get the questions asked in C Programming along with the years asked.

Also, here we are going to discuss some basic PYQs related to Data Structures & C Programming.

1. The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree? [GATE CSE 2020]

(A) 10, 11, 12, 15, 16, 18, 19, 20

(B) 11, 12, 10, 16, 19, 18, 20, 15

(C) 20, 19, 18, 16, 15, 12, 11, 10

(D) 19, 16, 18, 20, 11, 12, 10, 15

Solution: Correct answer is (B)

For more, refer to GATE | GATE CS 2020 | Question 15.

2. What is the worst-case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order? More than one answer may be correct. [GATE CSE 2020]

(A) Θ(n)

(B) Θ(n log n)

(C) Θ(n2)

(D) Θ(1)

Solution: Correct answer is (C)

For more, refer to GATE | GATE CS 2020 | Question 26.

3. What is the worst-case time complexity of inserting n2 elements into an AVL tree with n elements initially? [GATE CSE 2020]

(A) Θ(n4)

(B) Θ(n2)

(C) Θ(n2 log n)

(D) Θ(n3)

Solution: Correct answer is (C)

For more, refer to GATE | GATE CS 2020 | Question 16.

4. Consider the following C program. [GATE CSE 2018]

#include<stdio.h>
struct Ournode{
    char x,y,z;
};
int main(){
    struct Ournode p = {'1', '0', 'a'+2};
    struct Ournode *q = &p;
    printf ("%c, %c", *((char*)q+1), *((char*)q+2));
    return 0;
}

The output of this program is:

(A) 0, c

(B) 0, a+2

(C) ‘0’, ‘a+2’

(D) ‘0’, ‘c’

Solution: Correct answer is (A)

For more, refer to GATE | GATE CS 2018 | Question 33.

5. Consider the following C Program [GATE CSE 2016]

void f(int, short);
void main()
{
    int i = 100;
    short s = 12;
    short *p = &s;
    ___________ ; // call to f()
}

Which one of the following expressions, when placed in the blank above, will NOT result in a type-checking error?

(A) f(s, *s)

(B) i = f(i,s)

(C) f(i, *s)

(D) f(i, *p)

Solution: Correct answer is (D)

For more, refer to GATE | GATE-CS-2016 (Set 1) | Question 22.

6. A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)? [GATE CSE 2016]

(A) Both operations can be performed in O(1) time

(B) At most one operation can be performed on O(1) time but the worst-case time for the other operation will be Ω(n)

(C) The worst-case time complexity for both operations will be Ω(n)

(D) Worst case time complexity for both operations will be Ω(log n)

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2016 (Set 1) | Question 20.

7. The result evaluating the postfix expression 10 5 + 60 6/ * 8 – is [GATE CSE 2015]

(A) 284

(B) 213

(C) 142

(D) 71

Solution: Correct answer is (C)

For more, refer to GATE | GATE-CS-2015 (Set 3) | Question 65.

8. Let A be a square matrix of size n x n. Consider the following program. What is the expected output? [GATE CSE 2014]

C = 100
for i = 1 to n do
    for j = 1 to n do
    {
        Temp = A[i][j] + C
        A[i][j] = A[j][i]
        A[j][i] = Temp - C
    }
for i = 1 to n do
    for j = 1 to n do
        Output(A[i][j]);

(A) The matrix A itself

(B) Transpose of the matrix A

(C) Adding 100 to upper diagonal elements and subtracting 100 from diagonal elements of A

(D) None of the above

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2014-(Set-3) | Question 20.

9. Consider the following program in C language: [GATE CSE 2014]

#include<stdio.h>
main()
{
    int i;
    int *pi = &i;
    scanf("%d", pi);
    printf("%d\n", i+5);
}

Which one of the following statements is TRUE?

(A) Compilation fails

(B) Execution results in a run-time error

(C) On execution, the value printed is 5 more than the address of variable i

(D) On execution, the value printed is 5 more than the integer value entered

Solution: Correct answer is (D)

For more, refer to GATE | GATE-CS-2014-(Set-1) | Question 19.

10. A program P reads 500 integers in the range [0, 100] representing the cores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies? [GATE CSE 2005] 

(A) An array of 50 numbers

(B) An array of 100 numbers

(C) An array of 500 numbers

(D) A dynamically allocated array of 550 numbers

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2005 | Question 5.

GATE CSE Previous Year Question Papers

These previous year’s questions help you in understanding the question patterns followed by GATE that directly help a candidate in scoring good marks in GATE. Below are the mentioned links of year-wise GATE Previous Question Papers.

Last Updated :
20 May, 2023

Like Article

Save Article


Solving GATE Previous Year’s Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, which helps crack GATE with a good score. 

Data Structures & C Programming Previous Year GATE Questions help in analyzing the question pattern of a subject and marking scheme as well as it helps in time management which overall increases the score in the GATE exam. With regular practice of PYQs, candidates can easily crack GATE with a good GATE Score.

Before 2006, questions asked in GATE were mainly theoretical, but in recent years, the questions asked were multiple-choice questions with a single correct option or multiple correct options. We are looking to provide the multiple-choice questions that are asked in GATE.

Data Structures & C Programming GATE Previous Year Questions

In this article, we are mainly focusing on the Data Structures & C Programming GATE Questions that are asked in Previous Years with their solutions, and where an explanation is required, we have also provided the reason.

In Data Structures, we will deal with the following concepts. We have also provided GATE Previous Year’s Questions on these topics. Here is the list of those topics along with their links.

In C Programming, we will deal with the following concepts:

  • Arithmetic Operations
  • Conditional Statement
  • Loops
  • Array and Pointer
  • Functions

Below mentioned are the links to the C Programming PYQ’s pages. On each page, you will get the questions asked in C Programming along with the years asked.

Also, here we are going to discuss some basic PYQs related to Data Structures & C Programming.

1. The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree? [GATE CSE 2020]

(A) 10, 11, 12, 15, 16, 18, 19, 20

(B) 11, 12, 10, 16, 19, 18, 20, 15

(C) 20, 19, 18, 16, 15, 12, 11, 10

(D) 19, 16, 18, 20, 11, 12, 10, 15

Solution: Correct answer is (B)

For more, refer to GATE | GATE CS 2020 | Question 15.

2. What is the worst-case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order? More than one answer may be correct. [GATE CSE 2020]

(A) Θ(n)

(B) Θ(n log n)

(C) Θ(n2)

(D) Θ(1)

Solution: Correct answer is (C)

For more, refer to GATE | GATE CS 2020 | Question 26.

3. What is the worst-case time complexity of inserting n2 elements into an AVL tree with n elements initially? [GATE CSE 2020]

(A) Θ(n4)

(B) Θ(n2)

(C) Θ(n2 log n)

(D) Θ(n3)

Solution: Correct answer is (C)

For more, refer to GATE | GATE CS 2020 | Question 16.

4. Consider the following C program. [GATE CSE 2018]

#include<stdio.h>
struct Ournode{
    char x,y,z;
};
int main(){
    struct Ournode p = {'1', '0', 'a'+2};
    struct Ournode *q = &p;
    printf ("%c, %c", *((char*)q+1), *((char*)q+2));
    return 0;
}

The output of this program is:

(A) 0, c

(B) 0, a+2

(C) ‘0’, ‘a+2’

(D) ‘0’, ‘c’

Solution: Correct answer is (A)

For more, refer to GATE | GATE CS 2018 | Question 33.

5. Consider the following C Program [GATE CSE 2016]

void f(int, short);
void main()
{
    int i = 100;
    short s = 12;
    short *p = &s;
    ___________ ; // call to f()
}

Which one of the following expressions, when placed in the blank above, will NOT result in a type-checking error?

(A) f(s, *s)

(B) i = f(i,s)

(C) f(i, *s)

(D) f(i, *p)

Solution: Correct answer is (D)

For more, refer to GATE | GATE-CS-2016 (Set 1) | Question 22.

6. A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)? [GATE CSE 2016]

(A) Both operations can be performed in O(1) time

(B) At most one operation can be performed on O(1) time but the worst-case time for the other operation will be Ω(n)

(C) The worst-case time complexity for both operations will be Ω(n)

(D) Worst case time complexity for both operations will be Ω(log n)

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2016 (Set 1) | Question 20.

7. The result evaluating the postfix expression 10 5 + 60 6/ * 8 – is [GATE CSE 2015]

(A) 284

(B) 213

(C) 142

(D) 71

Solution: Correct answer is (C)

For more, refer to GATE | GATE-CS-2015 (Set 3) | Question 65.

8. Let A be a square matrix of size n x n. Consider the following program. What is the expected output? [GATE CSE 2014]

C = 100
for i = 1 to n do
    for j = 1 to n do
    {
        Temp = A[i][j] + C
        A[i][j] = A[j][i]
        A[j][i] = Temp - C
    }
for i = 1 to n do
    for j = 1 to n do
        Output(A[i][j]);

(A) The matrix A itself

(B) Transpose of the matrix A

(C) Adding 100 to upper diagonal elements and subtracting 100 from diagonal elements of A

(D) None of the above

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2014-(Set-3) | Question 20.

9. Consider the following program in C language: [GATE CSE 2014]

#include<stdio.h>
main()
{
    int i;
    int *pi = &i;
    scanf("%d", pi);
    printf("%d\n", i+5);
}

Which one of the following statements is TRUE?

(A) Compilation fails

(B) Execution results in a run-time error

(C) On execution, the value printed is 5 more than the address of variable i

(D) On execution, the value printed is 5 more than the integer value entered

Solution: Correct answer is (D)

For more, refer to GATE | GATE-CS-2014-(Set-1) | Question 19.

10. A program P reads 500 integers in the range [0, 100] representing the cores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies? [GATE CSE 2005] 

(A) An array of 50 numbers

(B) An array of 100 numbers

(C) An array of 500 numbers

(D) A dynamically allocated array of 550 numbers

Solution: Correct answer is (A)

For more, refer to GATE | GATE-CS-2005 | Question 5.

GATE CSE Previous Year Question Papers

These previous year’s questions help you in understanding the question patterns followed by GATE that directly help a candidate in scoring good marks in GATE. Below are the mentioned links of year-wise GATE Previous Question Papers.

Last Updated :
20 May, 2023

Like Article

Save Article

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.
Leave a comment