Interview Questions and Answers on malloc() & free() in C : (10)
Question: 1
(A) Allocated memory has undefined value
(B) It returns pointer to the allocated space
(C) Pointer is NULL if memory is not allcoated
(D) It doesn't lead to memory leak if memory is not de allocated
Compiler
Level: Beginner Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 2
(A) True
(B) False
Compiler
Level: Beginner Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 3
(A) 999
(B) 10
(C) 0
(D) Segmentation fault
Compiler
Level: Expert Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 4
(A) NULL
(B) cppbuzz
(C) Nothing is printed
(D) Typecasting Error
Compiler
Level: Expert Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 5
(A) Program runs smoothly
(B) Compilation Error
(C) Runtime Error- Program crashes
Compiler
Level: Expert Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 6
(A) True
(B) False
Compiler
Level: Practionar Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 7
(A) Program runs smoothly & nothing is printed
(B) Runtime Error : Crash
(C) Compilation Error
(D) None of these
Compiler
Level: Practionar Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 8
(A) Program runs smoothly
(B) Compilation Error
(C) Program runs smoothly but has memory leak
(D) Runtime Error : Crash
Compiler
Level: Practionar Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 9
(A) Compilation Error
(B) Runtime Error: Crash
(C) Program runs smoothly but has memory leak
(D) Program runs smoothly & nothing is printed
Compiler
Level: Practionar Category: malloc_free
[Posted by: Admin | Chicago, USA]
Question: 10
(A) _ptr is NULL 0x21f3010 @
(B) _ptr not NULL 0x21f3010 @
(C) Runtime Error: Segmentation Fault
(D) _ptr not NULL 0x21f3010
Compiler
Level: Expert Category: malloc_free
[Posted by: Admin | Chicago, USA]
C Programming Test
Compile C code here
Browse C Categories
Preprocessor Assembler Compilation Datatypes Arrays Variables Pointers Functions Loops Switch Structures Union Enum Goto & Labels Storage Classes Malloc & free Macros Conditional Operators File Handling gcc OthersSwitch to C++ Questions