Question Answer Tutorial Search
Home Search Add Question Linux Linux Basics File and Folder Environment Command Process

Memory

Shell Programming Mock Test Contact Feedback
Home
Search
Add Question
Linux
Linux Basics
File and Folder
Environment
Command
Process

Memory

Shell Programming
Mock Test
Subscribe/Unsubscribe
Email:
Social Media
Facebook

Misc Tutorials

References

Question and Answer Tutorial
Tutorials Point
Stack Overflow

Question Answer Tutorial - Linux->Memory

First Previous 1 2 3 4 5 6 Next Last
                        
Question: What is the output of this program?

   #include
   #inlcude
 
   int main()
   {
       int *ptr;
       double *ptr;
       printf("%d
",sizeof(ptr));
       return 0;    
   }
Answer: The compiler will give the error
Question: What is the output of this program?

   #include
   #include
 
   int main()
   {
       char *ptr;
       ptr = (char *)malloc(sizeof(char)*11);
       ptr = "MCQTutorial";
       printf("%s
",*ptr);
       return 0;
   }
Answer: Segmentation fault
Question: What is the output of this program?

   #include
   #include
 
   int main()
   {
   char *ptr;
       free(ptr);
       return 0    
   }
Answer: Aborted (core dumped)
Question: What is the output of this program?

   #include
   #include
 
   int main()
   { 
       int *ptr1;
       while(1){
           ptr1 = malloc(1024*1024);
           if(ptr1 == 0)
               break;
           sleep(1);
           printf("MCQTutorial
");
           free(ptr1);
       }
       return 0;
   }
Answer: It will print "MCQTutorial" until the process has be
en stopeed by any signal
Question: What is the output of this program?
   #include
   #include
 
   int main()
   {
       int *ptr1, *ptr2;
       ptr1 = malloc(4);
       *ptr1 = 10;
       *ptr2 = free(ptr1);
       printf("%d
",*ptr2);
       return 0;
   }
Answer: It will give an error
First Previous 1 2 3 4 5 6 Next Last
                        
Comment:
Name:Email:
Contact No.:
Copyright © 2014 by SBJ Group. All Rights Reserved. Developed and maintained by SBJ Group. Supported on Internet Explorer browser only