• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 46

Match the following List-I and List-II:
List-I List-II
P. Memory Leak 1.
#include 
  
void fun(int x) 
{ 
    if (x == 1) 
       return; 
    x = 6; 
    fun(x); 
} 
  
int main() 
{ 
   int x = 5; 
   fun(x); 
} 
Q. Dangling Pointer 2.
char* func()
{
   char str[10];
   strcpy(str,"Hello!");
   return(str); 
}
R. Stack Overflow 3.
#include < stdlib.h >

  void f() {
    int * ptr = (int * ) malloc(sizeof(int));
    /* Do some work */
    return;
  }
S. Wild Pointer 4.
int main() 
{ 
  int  *p; 
  int a = 10; 
  p = &a;  
  *p = 12; 
} 

(A)

P - 1, Q - 4, R - 3, S - 2

(B)

P - 1, Q - 2, R - 3, S - 4

(C)

P - 3, Q - 4, R - 1, S - 2

(D)

P - 3, Q - 2, R - 1, S - 4

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments