InterviewSolution
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. |
Can Math Operations Be Performed On A Void Pointer? |
|
Answer» No. POINTER addition and SUBTRACTION are based on advancing the pointer by a number of ELEMENTS. By definition, if you have a void pointer, you don’t know what it’s pointing to, so you don’t know the size of what it’s pointing to. If you want pointer ARITHMETIC to work on raw addresses, use character POINTERS. No. Pointer addition and subtraction are based on advancing the pointer by a number of elements. By definition, if you have a void pointer, you don’t know what it’s pointing to, so you don’t know the size of what it’s pointing to. If you want pointer arithmetic to work on raw addresses, use character pointers. |
|
| 52. |
How Do You Print An Address? |
|
Answer» The safest WAY is to use printf () (or fprintf() or sprintf()) with the %P specification. That PRINTS a void pointer (void*). Different compilers MIGHT print a pointer with different formats. Your COMPILER will pick a format that’s right for your environment. If you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a void*: printf (“%PN”, (void*) buffer);The safest way is to use printf () (or fprintf() or sprintf()) with the %P specification. That prints a void pointer (void*). Different compilers might print a pointer with different formats. Your compiler will pick a format that’s right for your environment. If you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a void*: |
|
| 53. |
Why Should I Prototype A Function? |
|
Answer» A function prototype tells the compiler what kind of arguments a function is looking to receive and what kind of return VALUE a function is going to give back. This approach helps the compiler ensure that calls to a function are made correctly and that no ERRONEOUS type conversions are TAKING place. A function prototype tells the compiler what kind of arguments a function is looking to receive and what kind of return value a function is going to give back. This approach helps the compiler ensure that calls to a function are made correctly and that no erroneous type conversions are taking place. |
|
| 54. |
Is It Possible To Execute Code Even After The Program Exits The Main () Function? |
|
Answer» The standard C LIBRARY provides a function named at EXIT () that can be used to perform “cleanup” operations when your program terminates. You can set up a set of functions you want to perform automatically when your program EXITS by PASSING function POINTERS to the at exit() function. The standard C library provides a function named at exit () that can be used to perform “cleanup” operations when your program terminates. You can set up a set of functions you want to perform automatically when your program exits by passing function pointers to the at exit() function. |
|
| 55. |
Which Expression Always Return True? Which Always Return False? |
Answer»
|
|
| 56. |
What Is Storage Class And What Are Storage Variable? |
|
Answer» A storage class is an ATTRIBUTE that changes the BEHAVIOR of a variable. It CONTROLS the LIFETIME, scope and linkage. There are five TYPES of storage classes.
A storage class is an attribute that changes the behavior of a variable. It controls the lifetime, scope and linkage. There are five types of storage classes. |
|
| 57. |
What Are The Advantages Of Auto Variables? |
| Answer» | |
| 58. |
Differentiate Between A Linker And Linkage? |
|
Answer» A LINKER converts an OBJECT CODE into an executable code by linking together the necessary build in functions. The form and place of declaration where the variable is declared in a program determine the LINKAGE of variable. A linker converts an object code into an executable code by linking together the necessary build in functions. The form and place of declaration where the variable is declared in a program determine the linkage of variable. |
|
| 59. |
Mention The Characteristics Of Arrays In C? |
Answer»
|
|
| 60. |
Write About Modular Programming? |
|
Answer» If a program is large, it is subdivided into a NUMBER of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is KNOWN as MODULAR PROGRAMMING. If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming. |
|
| 61. |
What Is A Function And Built-in Function? |
|
Answer» A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies ONE or more ACTIONS to be performed for a large program. Such subprograms are functions. The function supports only static and extern storage classes. By default, function assumes extern storage class. Functions have global scope. Only REGISTER or auto storage class is allowed in the function parameters. Built-in functions that PREDEFINED and supplied along with the compiler are known as built-in functions. They are also known as library functions. A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for a large program. Such subprograms are functions. The function supports only static and extern storage classes. By default, function assumes extern storage class. Functions have global scope. Only register or auto storage class is allowed in the function parameters. Built-in functions that predefined and supplied along with the compiler are known as built-in functions. They are also known as library functions. |
|
| 62. |
Can The Sizeof Operator Be Used To Tell The Size Of An Array Passed To A Function? |
|
Answer» No. There’s no way to tell, at runtime, how many ELEMENTS are in an ARRAY PARAMETER just by looking at the array parameter itself. Remember, PASSING an array to a function is exactly the same as passing a pointer to the FIRST element. No. There’s no way to tell, at runtime, how many elements are in an array parameter just by looking at the array parameter itself. Remember, passing an array to a function is exactly the same as passing a pointer to the first element. |
|
| 63. |
Why N++ Executes Faster Than N+1? |
|
Answer» The EXPRESSION n++ requires a SINGLE MACHINE instruction such as INR to carry out the INCREMENT operation whereas n+1 requires more instructions to carry out this operation. The expression n++ requires a single machine instruction such as INR to carry out the increment operation whereas n+1 requires more instructions to carry out this operation. |
|
| 65. |
Explain The Purpose Of Main( ) Function? |
|
Answer» The FUNCTION main( ) invokes other functions within it.It is the first function to be called when the program starts execution.
The function main( ) invokes other functions within it.It is the first function to be called when the program starts execution. |
|