MCQ Tutorial Search
Home Search Add Question Today's History Discussion Board Job Portal Linux Linux Basics File and Folder
Environment Command Process

Memory

Shell Programming Mock Test Contact Feedback
                        
Home
Search
Add Question
Today's History
Discussion Board
Job Portal
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

MCQ Tutorial - Linux->Memory

First Previous 1 2 3 4 5 6 Next Last
1.) What is the output of this program?
   #include
   #include
 
   int main()
   {
       int ret;
       int *ptr;
       ptr = (int *)malloc(sizeof(int)*10);
       free(ptr);
       free(ptr);
       return 0;
   }
Options are:
A.) None of the mentioned options
B.) Undefined behaviour
C.) It will print nothing
D.) It will give segmentaion fault
                        
2.) This program will allocate the memory of ___ bytes for pointer "ptr".

   #include
   #include
 
   int main()
   {
       int *ptr;
       ptr = (int*)malloc(sizeof(int)*4);
       ptr = realloc(ptr,sizeof(int)*2);
       return 0;
   }
Options are:
A.) 8
B.) None of the mentioned options
C.) 2
D.) 4
                        
3.) In this program the two printed memory locations has the difference of ___ bytes.

   #include
   #include
 
   int main()
   {
       int *ptr;
       ptr = (int*)malloc(sizeof(int)*2);
       printf("%p
",ptr);
       printf("%p
",ptr+1);
       return 0;
   }
Options are:
A.) None of the mentioned options
B.) 4
C.) 1
D.) Can not be determined
4.) What is the output of this program?

   #include
   #include
   #include                              
 
   int main()
   {
       char *ptr;
       memcpy(ptr,"MCQTutorial",11);
       printf("%s
",ptr);
       return 0;
   }
Options are:
A.) None of the mentioned options
B.) Segmentation fault
C.) MCQTutorial
D.) Syntax error
5.) Which one of the following in true about this program?

   #include
   #include
   #include                              
 
   int main()
   {
       char *ptr;
       printf("%p
",ptr);
       ptr = (char *)malloc(sizeof(char));
       printf("%p
",ptr);
       return 0;
   }
Options are:
A.) This program will give segmentation fault
B.) This program has some syntax error
C.) None of the mentioned options
D.) This program will print two same values
                        
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