Technical Question Bank : C Language Basics

Technical interviews are used to assess candidates for technical or specialist job positions. These interviews are conducted to test your field-specific knowledge. You are required to have a good understanding of C language basics. 
 
List of Technical Questions based on C Language Basics
  • Define local block?
  • Variables should be stored in local blocks. Yes or no?
  • A switch statement is better than multiple if statements in what all situations?
  • Can a switch statement be written without a default case?
  • Is it possible for the last case of a switch statement to skip including the break?
  • Barring the for statement, where else is the comma operator used?
  • How do you determine whether a loop ended prematurely?
  • Differentiate between goto, long jmp( ) and setjmp()?
  • Explain lvalue?
  • Can an array be an lvalue?
  • Explain rvalue?
  • Is right-to-left or left-to-right order guaranteed for operator precedence?
  • Differentiate between ++var and var++?
  • Explain the function of the modulus operator?
  • What is the most efficient way to store flag values?
  • Explain "bit masking"?
  • Are bit fields portable?
  • Is it better to bitshift a value than to multiply by 2?
  • What is meant by high-order and low-order bytes?
  • What is the way to store 16-bit and 32-bit numbers ?
  • Explain macro and its usage
  • What purpose does preprocessor fulfill for a program?
  • How can you avoid including a header more than once?
  • With the help of #include , can a file other than a .h file be included?
  • What is the benefit of using #define while declaring a constant?
  • What is the benefit of using enum while declaring a constant?
  • Why is it better to use an enum rather than a #define constant?
  • In demo versions, how are the portions of a program disabled?
  • What is better? Using a macro or using a function?
  • Explain the best way to comment out a section of code that contains comments?
  • Differentiate between #include and #include "file"?
  • Can it be defined which header file to include at compile time?
  • Is it possible that include files be nested?
  • How many levels deep can you nest include files?
  • Explain the significance of concatenation operator?
  • How do you create type-insensitive macros?
  • What are the standard predefined macros?
  • Explain the way to make a program print the line number where an error occurs?
  • Explain the way to make a program print the name of a source file where an error occurs?
  • How do you tell whether a program was compiled using C versus C++?
  • What is a pragma? What is #line used for?
  • Explain the usage of #line?
  • Explain the significance of __DATE__ and __TIME__ preprocessor commands?
  • How do you make sure that a program follows the ANSI C standard?
  • What is the procedure to override a defined macro?
  • How do you check whether a symbol is defined?
  • Do array subscripts always start with zero?
  • Can we address one element beyond the end of an array?
  • Is it possible to tell the size of an array passed to a function with the help of the size of operator?
  • What is better to navigate an array of values? To use a pointer or to use a subscripted array name?
  • Can an array tag be assigned a different address?
  • Differentiate between array_name and &array_name?
  • Why don't we use constant values to define an array's initial size?
  • Differentiate between a string and an array?
  • Is there an error if errno contains a non-zero number?
  • What is a stream?
  • How is a standard stream redirected?
  • How is a redirected standard stream restored?
  • Can we force stdout to be printed somewhere other than the screen?
  • Differentiate between text and binary modes?
  • How is it determined whether a stream function or a low-level function should be used?
  • How are the files listed in a directory?
  • How are the files' date and time listed in a directory?
  • How are the file names sorted in a directory?
  • How are the attributes of a file determined?
  • How is the PATH viewed?
  • How can a file be opened so that other programs can update it at the same time?
  • How can it be made sure that my program is the only one accessing a file?
  • How can it be prevented that another program from modify a part of a file that I am modifying?
  • How can Abort, Retry and Fail messages be avoided?
  • How do I read and write comma-delimited text?
  • Where are my variables stored in memory?
  • Is it needed for the variables to be initialized?
  • Explain the usage of a const pointer?
  • When should the register modifier be used? How does it help if at all it does?
  • When should we use the volatile modifier?
  • Is it possible for a variable to be both const and volatile?
  • When should we use the const modifier?
  • How reliable are floating-point comparisons?
  • How do you determine the maximum value that a numeric variable can hold?
  • Do any problems occur if we try to perform mathematical operations on different variable types?
  • Explain operator promotion?
  • When should we use type cast?
  • When should we not use a type cast?
  • Can a variable be declared / defined in a C header?
  • Differentiate between declaring a variable and defining a variable?
  • Can we declare static variables in a header file?
  • How does it benefit to use const for declaring constants?
  • When should a function be declared?
  • When do we prototype a function?
  • How many parameters should a function have?
  • What is a static function?
  • Is it necessary for a function to contain a return statement if it does not return a value?
  • How do you pass an array to a function by value?
  • Can the code be executed after it exits the main() function?
  • What does a function that is declared as PASCAL do differently?
  • Is it the same thing to use exit()or use return?
  • Differentiate between a string copy (strcpy) and a memory copy (memcpy)? Explain the usage of each
  • How do I remove the trailing spaces from a string?
  • How do I remove the leading spaces from a string?
  • How do I right-justify a string?
  • How do I pad a string to a known length?
  • How do I copy just a portion of a string?
  • How do I convert a number to a string?
  • How do I convert a string to a number?
  • How do you determine if two strings are the same?
  • Explain the way to print only part of a string?
  • What is indirection?
  • How many levels of pointers are possible?
  • What is a null pointer?
  • When do we use a null pointer?
  • What is a void pointer?
  • When do we use a void pointer?
  • Can pointers be subtracted from each other? When is it done?
  • Is NULL always defined as 0(zero)?
  • Is NULL always equal to 0(zero)?
  • What does it signify when a pointer is used in an if statement?
  • Can pointers be added? When is it done?
  • How do you use a pointer to a function?
  • When do you use a pointer to a function?
  • Can the array be declared at runtime?
  • Use of which of these is better: malloc() or calloc()?
  • How is an array that can hold more than 64KB of data declared?
  • Differentiate between far and near?
  • When is the far pointer used?
  • What is a stack?
  • What is a heap?
  • What happens if we free a pointer twice?
  • Differentiate between NULL and NUL?
  • What is a "null pointer assignment" error? Explain bus errors, memory faults, and core dumps?
  • How is the size of an allocated portion of memory determined?
  • How does free() know how much memory should be released?
  • Can we perform math operations on a void pointer?
  • How is an address printed?
  • Why should we use standard library functions instead of writing our own?
  • To define the standard library functions that we use, what header files do we need?
  • How are functions that take a variable number of arguments written?
  • Differentiate between a free-standing and a hosted environment?
  • Mention the standard functions available to manipulate strings?
  • How is it determined whether a character is numeric, alphabetic, and so on?
  • What is a "locale"?
  • Is there a way to jump out of a function or functions? If yes, what?
  • What is a signal? What do I use signals for?
  • Why should variable names not be started with underscores?
  • What are the math functions available for integers? For floating point?
  • What are multi-byte characters?
  • How can I manipulate strings of multi-byte characters?
 
Rate Us
Views:36586