Advertisements

Search results for stack overflow

Example:[1]

            What will be error the following program will face during execution?
#include <stdio.h> 
#include <string.h> 
void main ()  
{  
    char a[2] = "";
    strcpy(a,"Hello World");
    printf("%s\n", a);
}

          
Option A:

            Stack overflow
            
Option B:

            Heap overflow
            
Option C:

            Frozen memory
            
Option D:

            Memory leak
            
Correct Answer: option A
Example:[2]

            What will be error the following program will face during execution?
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#define BUFSIZE 2
void main() 
{
    char *buf;
    buf = (char *)malloc(sizeof(char)*BUFSIZE);
    strcpy(buf, "Hello world\n");
}
          
Option A:

            Stack overflow
            
Option B:

            Heap overflow
            
Option C:

            Frozen memory
            
Option D:

            Memory leak
            
Correct Answer: option B
Example:[3]

            If we continuously allocate memory and we do not free that memory space after use it may result in ______
          
Option A:

            Stack overflow
            
Option B:

            Heap overflow
            
Option C:

            Frozen memory
            
Option D:

            Memory leak
            
Correct Answer: option D
Example:[4]

            If we declare large number of local variables inside a function it can result in _______
          
Option A:

            Stack overflow
            
Option B:

            Heap overflow
            
Option C:

            Frozen memory
            
Option D:

            Memory leak
            
Correct Answer: option A

 Search Links


 Popular C search MCQs


 Popular C search examples