C Programming Questions and Answers


Overview of C Language

IdProgram TitleView
 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 ?

Data Types in C Language

IdProgram TitleView
 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?

Variable in C Language

IdProgram TitleView
 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 ?

Constant in C Language

IdProgram TitleView
 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?

Operators and Enums in C Language

IdProgram TitleView
 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?

Decision Making of C Language

IdProgram TitleView
 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?

Loop control in C Language

IdProgram TitleView
 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?

Array in C Language

IdProgram TitleView
 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?

String in C Language

IdProgram TitleView
 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?

Function in C Language

IdProgram TitleView
 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?

Pointer in C Language

IdProgram TitleView
 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?

Structure in C Language

IdProgram TitleView
 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

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

File Input/Output

IdProgram TitleView
 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

IdProgram TitleView
 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

IdProgram TitleView
 0  What is a preprocessor?
 1  How will you print "Hello World" without semicolon in c programming Language using #define?









Control Flow in C Programming

IdProgram TitleView
 0  What are the different types of control structures in programming?



Coming Soon.....