Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Is Using Exit () The Same As Using Return?

Answer»

No, The exit () function is used to exit your PROGRAM and return CONTROL to the operating system.The return statement is used to return from a function and return control to the calling function. If you ISSUE a return from the MAIN () function, you are essentially returning control to the calling function, which is the operating system. In this CASE, the return statement and exit () function are similar.

No, The exit () function is used to exit your program and return control to the operating system.The return statement is used to return from a function and return control to the calling function. If you issue a return from the main () function, you are essentially returning control to the calling function, which is the operating system. In this case, the return statement and exit () function are similar.

52.

When Does The Compiler Not Implicitly Generate The Address Of The First Element Of An Array?

Answer»

Whenever an ARRAY name appears in an expression such as
• Array as an operand of the SIZEOF operator.
• Array as an operand of “&” operator.
• Array as a string LITERAL initializer for a character array.
Then the COMPILER does not IMPLICITLY generate the address of the address of the first element of an array.

Whenever an array name appears in an expression such as
• Array as an operand of the sizeof operator.
• Array as an operand of “&” operator.
• Array as a string literal initializer for a character array.
Then the compiler does not implicitly generate the address of the address of the first element of an array.

53.

What Are The Different Storage Classes In C?

Answer»

C has three types of STORAGE: AUTOMATIC, STATIC and allocated. Variable having BLOCK scope and without static specifier have automatic storage duration. Variables with block scope and with static specifier have static scope. Global variables (i.e., file scope) with or without the static specifier also have static scope. Memory OBTAINED from calls to malloc(), alloc() or realloc() belongs to storage class.

C has three types of storage: automatic, static and allocated. Variable having block scope and without static specifier have automatic storage duration. Variables with block scope and with static specifier have static scope. Global variables (i.e., file scope) with or without the static specifier also have static scope. Memory obtained from calls to malloc(), alloc() or realloc() belongs to storage class.

54.

How Do You Override A Defined Macro?

Answer»

You can use the #undef preprocessor DIRECTIVE to undefined (override) a PREVIOUSLY DEFINED macro.

You can use the #undef preprocessor directive to undefined (override) a previously defined macro.

55.

What Is Page Thrashing?

Answer»

It happens when a high level of paging activity. Thrashing is caused by under allocation of minimum number of pages required by a PROCESS, forcing it to CONTINUOUSLY PAGE FAULT

It happens when a high level of paging activity. Thrashing is caused by under allocation of minimum number of pages required by a process, forcing it to continuously page fault. 

56.

Advantages Of A Macro Over A Function?

Answer»

Actually macro and FUNCTION are used for different purposes. A macro REPLACES its expression CODE PHYSICALLY in the code at the time of preprocessing. But in case of function the control goes to the function while executing the code. So when the code is small then it is better to use macro. But when code is large then function should be used.

Actually macro and function are used for different purposes. A macro replaces its expression code physically in the code at the time of preprocessing. But in case of function the control goes to the function while executing the code. So when the code is small then it is better to use macro. But when code is large then function should be used.

57.

What Is A Null Pointer?

Answer»

A null pointer is a special pointer value that is known not to POINT anywhere. It means that no other valid pointer, to any other variable or array cell or anything else, will ever COMPARE equal to a null pointer.

A null pointer is a special pointer value that is known not to point anywhere. It means that no other valid pointer, to any other variable or array cell or anything else, will ever compare equal to a null pointer.

58.

What Is The Difference Between Calloc() And Malloc() ?

Answer»

A block of memory may be allocated using the function malloc. The malloc function reserves a block of memory of specified size and RETURNS a pointer of type void. This means we can assign the base address of the block to any type of pointer.
  Syntax – P = (cast type*)malloc(byte size);
Calloc is also a memory allocation function which is generally USED to allocate memory for ARRAY and STRUCTURE .malloc is used to allocate a single block of storage space, calloc allocates multiple blocks of storage, each of same size and initializes them with ZERO.
Syntax - P = (cast type*)calloc(n,array size);

A block of memory may be allocated using the function malloc. The malloc function reserves a block of memory of specified size and returns a pointer of type void. This means we can assign the base address of the block to any type of pointer.
  Syntax – P = (cast type*)malloc(byte size);
Calloc is also a memory allocation function which is generally used to allocate memory for array and structure .malloc is used to allocate a single block of storage space, calloc allocates multiple blocks of storage, each of same size and initializes them with zero.
Syntax - P = (cast type*)calloc(n,array size);

59.

What Does Static Variable Mean?

Answer»

Static variable is available to a C APPLICATION, throughout the life time. At the time of starting the program execution, static variables allocations takes place FIRST. In a scenario where one variable is to be used by all the functions (which is accessed by main () function), then the variable NEED to be DECLARED as static in a C program.

Static variable is available to a C application, throughout the life time. At the time of starting the program execution, static variables allocations takes place first. In a scenario where one variable is to be used by all the functions (which is accessed by main () function), then the variable need to be declared as static in a C program.

60.

What Is C Language?

Answer»

C is a programming language used to WRITE a program. Programs are the set of INSTRUCTIONS given by a programmer to the computer in high level language. C uses a COMPILER to translate the high level program into machine code before EXECUTING any instruction.

C is a programming language used to write a program. Programs are the set of instructions given by a programmer to the computer in high level language. C uses a compiler to translate the high level program into machine code before executing any instruction.