Author name: admin

Which of the following should be used to free memory from a pointer allocated using the “new” operator?

Which of the following should be used to free memory from a pointer allocated using the “new” operator? a) delete b) free() c) dealloc() d) None of the above Answer: a) delete Explanation: In C++, the delete operator should be used to free memory allocated by the new operator. Using free() with new-allocated memory is

Which of the following should be used to free memory from a pointer allocated using the “new” operator? Read More »

Which of the following is the proper syntax for declaring macros in C?

Which of the following is the proper syntax for declaring macros in C? a) #define MACRO() b) #macro MACRO c) #define MACRO d) macro_define MACRO Answer: c) #define MACRO Explanation: The correct syntax for declaring a macro in C is using the #define directive followed by the macro name, and optionally, its replacement text. For

Which of the following is the proper syntax for declaring macros in C? Read More »

Which of the following are correct file opening modes in C?

Which of the following are correct file opening modes in C? a) “r”, “w”, “b” b) “r”, “w”, “rb”, “wb” c) “rb”, “w”, “wb”, “r” d) “rw”, “wr”, “r”, “w” Answer: b) “r”, “w”, “rb”, “wb” Explanation: In C, file opening modes are specified when you open a file using the fopen() function. Common modes

Which of the following are correct file opening modes in C? Read More »

What is the maximum number of characters that can be held in the string variable char address[40]?

What is the maximum number of characters that can be held in the string variable char address[40]? a) 39 b) 40 c) 41 d) 38 Answer: a) 39 Explanation: The maximum number of characters that can be held in the string variable char address[40] is 39 because one space is reserved for the null terminator

What is the maximum number of characters that can be held in the string variable char address[40]? Read More »

What is a lint?

What is a lint? a) A compiler b) An interpreter c) A debugger d) A tool for analyzing code Answer: d) A tool for analyzing code Explanation: Lint is a tool used to analyze C code for potential errors, bugs, stylistic issues, and suspicious constructs. It helps developers identify issues that might not be caught

What is a lint? Read More »

Scroll to Top