C Interview Questions PDF
C Interview Questions PDF
C Interview Questions PDF
Interview Questions with Answers pdf free download for freshers 1 2 3 4 5 6 7 8 9 10+ years experience also
provide certification MCQs Real time Objective FAQs & Tutorials
Toggle navigation
Home
About US
Privacy Policy
TERMS & CONDITIONS
Contact US
4. Why C Language?
C is one of the high level languages. It is a general purpose language, which means it can be used to write
programs of any sort.
In C one can write programs like that of high level languages as in COBOL, BASIC, FORTRAN etc. as
well as it permits very close interaction with the inner workings of the computer.
It is a general purpose programming language. It is usually called system programming language but
equally suited to writing a variety of applications.
It supports various data types
It follows the programming style based on fundamental control flow constructions for structured
programming
Functions may be predefined or user defined and they may return values of basic types, structures, unions
or pointers.
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-an… 1/10
12/21/2018 125 TOP C PROGRAMMING Theory Questions and Answers Pdf
C LANGUAGE Interview
Questions
1. Easy to write
2. Rich set of operators and functions that are built–in
3. Support for bit–wise operation
4. Flexible use of pointers
5. Direct control over the hardware
6. Ability to access BIOS/DOS routines
7. Interacting using Interrupts
8. Ability to write TSR programs
9. Ability to create .COM files
10. Ability to create library files (.LIB)
11. Ability to write interface programs
12. Incorporating assembly language in C program
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-an… 2/10
12/21/2018 125 TOP C PROGRAMMING Theory Questions and Answers Pdf
1. Constants
2. Identifiers
3. Keywords
4. Operators
5. Special symbols
6. Strings
Control Instruction
Simple
Parameterized
1. Compile–Time Errors
2. Linker Errors
3. Runtime Errors
4. Logical Errors
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-an… 4/10
12/21/2018 125 TOP C PROGRAMMING Theory Questions and Answers Pdf
The function main() invokes other functions within it.It is the first function to be called when the
program starts execution.
It is the starting function.
It returns an int value to the environment that called the program.
Recursive call is allowed for main( ) also.
It is a user-defined function.
Char
Int
Float
Double
Void
1. Short
2. Long
3. Signed
4. Unsigned
41. Define what is the difference between single charater constant and string constant?
A single character constant consists of only one character and it is enclosed within a pair of single quotes.
A string constant consists of one or more characters and it is enclosed within a pair of double quotes.
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-an… 5/10
12/21/2018 125 TOP C PROGRAMMING Theory Questions and Answers Pdf
47. Define what are the types of data types and explain?
There are five basic Data types in C. These are :
55. Not all reserved words are written in lowercase. TRUE or FALSE?
FALSE. All reserved words must be written in lowercase; otherwise the C compiler would interpret this as
unidentified and invalid.
56. Define what is the difference between the expression “++a” and “a++”?
In the first expression, the increment would happen first on variable a, and the resulting value will be the one to
be used. This is also known as a prefix increment. In the second expression, the current value of variable a
would the one to be used in an operation, before the value of a itself is incremented. This is also known as
postfix increment.
57. Define what would happen to X in this expression: X += 15; (assuming the value of X is 5)
X +=15 is a short method of writing X = X + 15, so if the initial value of X is 5, then 5 + 15 = 20.
58. In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
FALSE. C language is a case sensitive language. Therefore, NAME, name and Name are three uniquely
different variables.
60. Define what is a program flowchart and Define How does it help in writing a program?
A flowchart provides a visual representation of the step by step procedure towards solving a given problem.
Flowcharts are made of symbols, with each symbol in the form of different shapes. Each shape may represent a
particular entity within the entire program structure, such as a process, a condition, or even an input/output
phase.
61. Define what is wrong with this program statement? void = 10;
The word void is a reserved word in C language. You cannot use reserved words as a user-defined variable.
67. Define what is the difference between functions abs() and fabs()?
These 2 functions basically perform the same action, which is to get the absolute value of the given value.
Abs() is used for integer values, while fabs() is used for floating type numbers. Also, the prototype for abs() is
under <stdlib.h>, while fabs() is under <math.h>.
70. Write a simple code fragment that will check if a number is positive or negative.
[c]
If (num>=0)
printf("number is positive");
else
printf ("number is negative");
[/c]
72. Define what are global variables and Define How do you declare them?
Global variables are variables that can be accessed and manipulated anywhere in the program. To make a
variable global, place the variable declaration on the upper portion of the program, just after the preprocessor
directives section.
78. Define what is the difference between functions getch() and getche()?
Both functions will accept a character input value from the user. When using getch(), the key that was pressed
will not appear on the screen, and is automatically captured and assigned to a variable. When using getche(),
the key that was pressed by the user will appear on the screen, while at the same time being assigned to a
variable.
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-an… 8/10
12/21/2018 125 TOP C PROGRAMMING Theory Questions and Answers Pdf
79. Dothese two program statements perform the same output? 1) scanf(“%c”, &letter); 2) letter=getchar()
Yes, they both do the exact same thing, which is to accept the next key pressed by the user and assign it to
variable named letter.
81. Define what does the characters “r” and “w” mean when writing programs that will make use of
files?
“r” means “read” and will open a file as input wherein data is to be retrieved. “w” means “write”, and will open
a file for output. Previous data that was stored on that file will be erased.
82. Define what is the difference between text files and binary files?
Text files contain data that can easily be understood by humans. It includes letters, numbers and other
characters. On the other hand, binary files contain 1s and 0s that only computers can interpret.
88. In a switch statement, Define what will happen if a break statement is omitted?
If a break statement was not placed at the end of a particular case portion? It will move on to the next case
portion, possibly causing incorrect output.
89. Describe Define How arrays can be passed to a user defined function
One thing to note is that you cannot pass the entire array to a function. Instead, you pass to it a pointer that will
point to the array first element in memory. To do this, you indicate the name of the array without the brackets.
input, the entire line of characters is stored to a string variable. Note that the enter key is not included in the
variable, but instead a null terminator is placed after the last character.
93. The % symbol has a special use in a printf statement. Define How would you place this character as
part of the output on the screen?
You can do this by using %% in the printf statement. For example, you can write printf(“10%%”) to have the
output appear as 10% on the screen.
94. Define How do you search data in a data file using random access method?
Use the fseek() function to perform random access input/ouput on a file. After the file was opened by the
fopen() function, the fseek would require three parameters to work: a file pointer to the file, the number of
bytes to search, and the point of origin in the file.
95. Are comments included during the compilation stage and placed in the EXE file as well?
No, comments that were encountered by the compiler are disregarded. Comments are mostly for the guidance
of the programmer only and do not have any other significant use in the program functionality.
96. Is there a built-in function in C that can be used for sorting data?
Yes, use the qsort() function. It is also possible to create user defined functions for sorting, such as those based
on the balloon sort and bubble sort algorithm.
99. Create a simple code fragment that will swap the values of two variables num1 and num2.
[c]
int temp;
temp = num1;
num1 = num2;
num2 = temp;
[/c]
100. Define what is the use of a semicolon (;) at the end of every program statement?
It has to do with the parsing process and compilation of the code. A semicolon acts as a delimiter, so that the
compiler knows where each statement ends, and can proceed to divide the statement into smaller elements for
syntax checking.
{ Add a Comment }
http://webcache.googleusercontent.com/search?q=cache:http://interviewquestionstutorials.com/tag/125-top-c-programming-theory-questions-a… 10/10