C Programming Questions and Answers


Overview of C Language

 0  What is a token?
 1  What is the purpose of the keyword typedef?
 2  What is difference between including the header file with-in angular braces < > and double quotes " "
 3  What is keyword auto for?
 4  What is volatile keyword?
 5  What are main characteristics of C language?
 6  How will you print "Hello World" without semicolon?
 7  What is a static identifier?
 8  What are the valid places for the keyword break to appear.
 9  Describe the history of C programming language.
 10  Which key word is used to perform unconditional branching?
 11  Which compiler switch to be used for compiling the programs using math library with gcc compiler?
 12  Can the curly brackets { } be used to enclose a single line of code?
 13  What are header files and what are its uses in C programming?
 14  What is syntax error?
 15  Can two or more operators such as and be combined in a single line of program code?
 16  Why is it that not all header files are declared in every C program?
 17  When is the "void" keyword used in a function?
 18  What are compound statements?
 19  What is wrong in this statement? scanf("%d",whatnumber);
 20  What are comments and how do you insert it in a C program?
 21  What are reserved words?
 22  Not all reserved words are written in lowercase. TRUE or FALSE?
 23  What are run-time errors?
 24  What is the difference between functions abs() and fabs()?
 25  What is the general form of a C program?
 26  What is the use of a semicolon (;) at the end of every program statement?
 27  What is Standard Header Files ?
 28  What is printf()?
 29  What is scanf()?
 30  Execution of a C program starts from which function?
 31  What are all the sections that a C program may have and must have?
 32  What is IDE?
 33  What is header file in C language?
 34  What is void in C?
 35  What is token in C?
 36  What are the types of C tokens?
 37  What is identifier in C?
 38  What is keyword in C?
 39  List out some keywords available in C language.
 40  What is the syntax for comments in C?

Data Types in C Language

 0  How a negative integer is stored.
 1  Can I use "int" data type to store the value 32768? Why?
 2  What are the different data types in C?
 3  What is data type in C?
 4  What is the difference between int, char, float and double data types?
 5  What is modifier in C?
 6  What are different types of modifiers in C?

Variable in C Language

 0  What is the difference between variable declaration and variable definition? ( in a line)
 1  Where an automatic variable is stored?
 2  When should we use the register storage specifier?
 3  What is the purpose of extern storage specifier?
 4  What is a static variable?
 5  Can a variable be both const and volatile?
 6  What are local static variables? What is their use?
 7  What is the difference between declaration and definition of a variable/function
 8  What are different storage class specifiers in C?
 9  What is the difference between declaration and definition of a variable/function
 10  What does static variable mean?
 11  Where is the auto variables stored?
 12  Where does global, static, and local, register variables, free memory and C Program instructions get stored?
 13  Describe about storage allocation and scope of global, extern, static, local and register variables?
 14  What are register variables? What are the advantages of using register variables?
 15  What is storage class? What are the different storage classes in C?
 16  What is variable initialization and why is it important?
 17  What is wrong with this program statement? void = 10;
 18  Is this program statement valid? INT = 10.50;
 19  What are global variables and how do you declare them?
 20  What is Blocks and Scope in c ?
 21  What is Variable Storage Classes?
 22  What is Variable Declaration ?
 23  What is variable in C?
 24  What is the difference between constant and variable in C?
 25  Can variable name start with numbers?
 26  What is the difference between variable declaration and variable definition in C?
 27  What are the different types of variable in C?
 28  What is local variable in C?
 29  What is global variable in C?
 30  What is environment variable in C?
 31  What is the difference between auto variable and register variable in C?
 32  What is the difference between auto variable and static variable in C?

Constant in C Language

 0  What is lvalue and rvalue?
 1  What is l-value?
 2  Can we specify variable field width in a scanf() format string? If possible how?
 3  What are variables and it what way is it different from constants?
 4  What is constant in C?
 5  What are the types of constants in C?

Operators and Enums in C Language

 0  S++ or S = S+1, which can be recommended to increment the value by 1 and why?
 1  What is difference between i++ and ++i?
 2  What are enumerations?
 3  Where the address of operator (&) cannot be used for?
 4  What is reminder for 5.0 % 2?
 5  How many operators are there under the category of ternary operators?
 6  Explain the use of comma operator (,).
 7  How do you construct an increment statement or decrement statement in C?
 8  What is the difference between the = symbol and == symbol?
 9  What is the modulus operator?
 10  Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
 11  What does the && operator do in a program code?
 12  What is || operator and how does it function in a program?
 13  Describe the order of precedence with regards to operators in C.
 14  What is the difference between the expression "++a" and "a++"?
 15  What are enumerated types?
 16  What is the use of sizeof() function in C?
 17  What is enum in C?
 18  What is operator in C?
 19  What are the different types of operator in C?
 20  What is the syntax for ternary operator in C?
 21  What is arithmetic operator in C?
 22  What is assignment operator in C?
 23  What is the relational operator in C?
 24  What is the logical operator in C?
 25  What is the bitwise operator in C?
 26  What is the difference between pre increment operator and post increment operator?
 27  What is the difference between pre decrement operator and post decrement operator?
 28  What is & and * operators in C?
 29  What value will be assigned to the variable X if a = 10, b = 20, c = 30, d = 40 for the expression X = a/b+c*d-c?
 30  What is the value assigned to the following variables? int X1 = 13/3; int X2 = 13%3;

Decision Making of C Language

 0  Does a break is required by default case in switch statement?
 1  In a switch statement, what will happen if a break statement is omitted?
 2   How will you print "Hello World" without semicolon in c programming Language?
 3   How will you print "Hello World" without semicolon in c programming Language?
 4  What are all decision control statements in C?
 5  What will happen if break statement is not used in switch case in C?
 6  Why is default statement used in switch case in C?

Loop control in C Language

 0  How will you print numbers from 1 to 100 without using a loop?
 1  Differentiate between for loop and a while loop? What are its uses?
 2  Explain the syntax for for loop.
 3  What is a nested loop?
 4  Write a loop statement that will show the following output: 1 12 123 1234 12345
 5  What is an endless loop?
 6  What are all loop control statements in C?
 7  What is the difference between while and do-while loops in C?

Array in C Language

 0  What is the meaning of base address of the array?
 1  How do you access the values within an array?
 2  What is the advantage of an array over individual variables?
 3  What are multidimensional arrays?
 4  Describe how arrays can be passed to a user defined function
 5  What is the right way to Initialize array?
 6  Can array subscripts have negative value in C?

String in C Language

 0  What is the difference between Strings and Arrays?
 1  What is the use of a character?
 2  How do you declare a variable that will hold string values?
 3  What is wrong with this statement? myName = "Nurujjaman";
 4  How do you determine the length of a string value that was stored in a variable?
 5  How do you convert strings to numbers in C?
 6  What is the difference between memcpy() and memmove() functions in C?
 7  What is the difference between strcpy() and strncpy() functions in C?
 8  What is the difference between array and string in C?

Function in C Language

 0  Explain the use of %i format specifier w.r.t scanf().
 1  what is modular programming.
 2  Does a built-in header file contains built-in function definition?
 3  What is the difference between actual and formal parameters?
 4  Can a program be compiled without main() function?
 5  What are static functions? What is their use?
 6  In header files whether functions are declared or defined?
 7  Out of fgets() and gets() which function is safe to use and why?
 8  Difference between strdup and strcpy?
 9  What is recursion?
 10  How can you print a (backslash) using any of the printf() family of functions.
 11  What are the different ways of passing parameters to the functions? Which to use when?
 12  What is a static function?
 13  What is the difference between Call by Value and Call by Reference?
 14  How do you generate random numbers in C?
 15  What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
 16  What are actual arguments?
 17  What does the function toupper() do?
 18  Is it possible to have a function as a parameter in another function?
 19  What is the difference between functions getch() and getche()?
 20  Can you pass an entire structure to functions?
 21  What is gets() function?
 22  How do you search data in a data file using random access method?
 23   Is there a built-in function in C that can be used for sorting data?
 24  What is function prototype?
 25  Where should type cast function not be used in C?
 26  How many arguments can be passed to a function in C?
 27  What is static function in C?
 28  If you want to execute C program even after main function is terminated, which function can be used?
 29  Is it possible to call atexit() function more than once in a C program?
 30  What is exit() function in C?
 31  What is the difference between exit() and return() in C?
 32  Is there any inbuilt library function in C to remove leading and trailing spaces from a string? How will you remove them in C?

Pointer in C Language

 0  What is the advantage of declaring void pointers?
 1  What is a dangling pointer? in one line
 2  What is a pointer on pointer?
 3  What is Dangling pointer?
 4  When should we use pointers in a C program?
 5  What is a pointer?
 6  What are the uses of a pointer?
 7  Difference between pass by reference and pass by value?
 8  What is a far pointer? Where we use it?
 9  What is a huge pointer?
 10  What is a normalized pointer, how do we normalize a pointer?
 11  When to user -> (arrow) operator.
 12  What is a pointer to a function? Give the general syntax for the same.
 13  What is a NULL statement?
 14  What are pointers?
 15  What is null pointer in C?
 16  What is NULL in C?
 17  What is void pointer in C?
 18  What is dangling pointer in C?
 19  What is wild pointer in C?
 20  What is file pointer in C?
 21  When can void pointer and null pointer be used in C?
 22  What is const pointer in C?

Structure in C Language

 0  What is a self-referential structure?
 1  What is a nested structure?
 2  What is a structure?
 3  What are the differences between structures and arrays?
 4  What is the use of typedef?
 5  What are bit fields?
 6  What are structure types in C?

Union in C Language

 0  What is a union?
 1  What are the differences between structures and union?
 2  What the advantages of using Unions?

File Input/Output

 0  Explain the purpose of the function sprintf().
 1  Describe the file opening mode "w+".
 2  Is FILE a built-in data type?
 3  What is a sequential access file?
 4  What does the characters "r" and "w" mean when writing programs that will make use of files?
 5  What is the difference between text files and binary files?
 6  What is the advantage of a random access file?
 7  Are comments included during the compilation stage and placed in the EXE file as well?

Dynamic Memory Allocation

 0  Distinguish between malloc() and calloc() memory allocation.
 1  What is memory leak? Why it should be avoided
 2  What are the differences between malloc () and calloc ()?
 3  What are macros? What are its advantages and disadvantages?
 4  Difference between arrays and linked list?

C Pre-processor

 0  What is a preprocessor?
 1  How will you print "Hello World" without semicolon in c programming Language using #define?
 2  What is Macro? Why do we use the macro?
 3  What is the use of #define in C?
 4  What is ## operator in C?
 5  What is pragma in C? Or how will you execute functions before and after main function in C program?
 6  How will you override an existing macro in C?
 7  How to check whether macro is defined or not in a C program?









Control Flow in C Programming

 0  What are the different types of control structures in programming?
 1  What is the use of goto statement?



Coming Soon.....