- C Language Questions And Answers Pdf Free Download
- C Language Questions And Answers Pdf In Hindi
- C Language Questions And Answers Pdf
- 250+ C And C Interview Questions and Answers, Question1: What is the difference between C and C? Question2: What is the difference between declaration and definition? Question3: If you want to share several functions or variables in several files maintaining the consistency how would you share it? Question4: What do you mean by translation unit?
- Basic Computer Questions & Answers PDF: Download Basic Computer Questions & Answers PDF. Practice Important Computer Questions and Answers for Competitive Exams based on asked questions in previous papers. Practice 100 FREE Important Computer Awareness Tests Download IBPS Clerk Previous papers PDF Go to Free Banking Study Material (15,000 Solved Questions) Question 1: What is an.
- Download BECE Past Questions and answers PDF. The Basic Education Certificate Exam Past Questions and Answers is available in all subjects. Download Up-to-date below. The BECE will be written by candidates who are in Junior Secondary 3 (JSS3). This is also called Junior NECO or Junior WAEC. So, Students who passed the BECE exam are.
Its for beginner.
- C Programming Tutorial
- C Programming useful Resources
- Selected Reading
Dear readers, these C Programming Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of C Programming. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −
- What is a pointer on pointer?
It’s a pointer variable which can hold the address of another pointer variable. It de-refers twice to point to the data held by the designated pointer variable.
Therefore ‘x’ can be accessed by **q.
- Distinguish between malloc() & calloc() memory allocation.
Both allocates memory from heap area/dynamic memory. By default calloc fills the allocated memory with 0’s.
- What is keyword auto for?
By default every local variable of the function is automatic (auto). In the below function both the variables ‘i’ and ‘j’ are automatic variables.
NOTE − A global variable can’t be an automatic variable.
- What are the valid places for the keyword break to appear.
Break can appear only with in the looping control and switch statement. The purpose of the break is to bring the control out from the said blocks.
- Explain the syntax for for loop.
When control reaches for expression-1 is executed first. Then following expression-2, and if expression-2 evaluates to non-zero ‘set of statements’ and expression-3 is executed, follows expression-2.
- What is difference between including the header file with-in angular braces < > and double quotes “ “
If a header file is included with in < > then the compiler searches for the particular header file only with in the built in include path. If a header file is included with in “ “, then the compiler searches for the particular header file first in the current working directory, if not found then in the built in include path.
- How a negative integer is stored.
Get the two’s compliment of the same positive integer. Eg: 1011 (-5)
Step-1 − One’s compliment of 5 : 1010
Step-2 − Add 1 to above, giving 1011, which is -5
- What is a static variable?
A static local variables retains its value between the function call and the default value is 0. The following function will print 1 2 3 if called thrice.
If a global variable is static then its visibility is limited to the same source code.
- What is a NULL pointer?
A pointer pointing to nothing is called so. Eg: char *p=NULL;
- What is the purpose of extern storage specifier?
Used to resolve the scope of global symbol.
- Explain the purpose of the function sprintf().
Prints the formatted output onto the character array.
- What is the meaning of base address of the array?
The starting address of the array is called as the base address of the array.
- When should we use the register storage specifier?
If a variable is used most frequently then it should be declared using register storage specifier, then possibly the compiler gives CPU register for its storage to speed up the look up of the variable.
- S++ or S = S+1, which can be recommended to increment the value by 1 and why?
S++, as it is single machine instruction (INC) internally.
- What is a dangling pointer?
A pointer initially holding valid address, but later the held address is released or freed. Then such a pointer is called as dangling pointer.
- What is the purpose of the keyword typedef?
It is used to alias the existing type. Also used to simplify the complex declaration of the type.
- What is lvalue and rvalue?
The expression appearing on right side of the assignment operator is called as rvalue. Rvalue is assigned to lvalue, which appears on left side of the assignment operator. The lvalue should designate to a variable not a constant.
- What is the difference between actual and formal parameters?
The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters.
- Can a program be compiled without main() function?
Yes, it can be but cannot be executed, as the execution requires main() function definition.
- What is the advantage of declaring void pointers?
When we do not know what type of the memory address the pointer variable is going to hold, then we declare a void pointer for such.
- Where an automatic variable is stored?
Every local variable by default being an auto variable is stored in stack memory.
- What is a nested structure?
A structure containing an element of another structure as its member is referred so.
- What is the difference between variable declaration and variable definition?
Declaration associates type to the variable whereas definition gives the value to the variable.
- What is a self-referential structure?
A structure containing the same structure pointer variable as its element is called as self-referential structure.
- Does a built-in header file contains built-in function definition?
No, the header file only declares function. The definition is in library which is linked by the linker.
- Explain modular programming.
Dividing the program in to sub programs (modules/function) to achieve the given task is modular approach. More generic functions definition gives the ability to re-use the functions, such as built-in library functions.
- What is a token?
A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.
- What is a preprocessor?
Preprocessor is a directive to the compiler to perform certain things before the actual compilation process begins.
- Explain the use of %i format specifier w.r.t scanf().
Can be used to input integer in all the supported format.
- How can you print a (backslash) using any of the printf() family of functions.
Escape it using (backslash).
- Does a break is required by default case in switch statement?
Yes, if it is not appearing as the last case and if we do not want the control to flow to the following case after default if any.
- When to user -> (arrow) operator.
If the structure/union variable is a pointer variable, to access structure/union elements the arrow operator is used.
- What are bit fields?
We can create integer structure members of differing size apart from non-standard size using bit fields. Such structure size is automatically adjusted with the multiple of integer size of the machine.
- What are command line arguments?
The arguments which we pass to the main() function while executing the program are called as command line arguments. The parameters are always strings held in the second argument (below in args) of the function which is array of character pointers. First argument represents the count of arguments (below in count) and updated automatically by operating system.
- What are the different ways of passing parameters to the functions? Which to use when?
Call by value − We send only values to the function as parameters. We choose this if we do not want the actual parameters to be modified with formal parameters but just used.
Call by reference − We send address of the actual parameters instead of values. We choose this if we do want the actual parameters to be modified with formal parameters.
- What is the purpose of built-in stricmp() function.
It compares two strings by ignoring the case.
- Describe the file opening mode “w+”.
Opens a file both for reading and writing. If a file is not existing it creates one, else if the file is existing it will be over written.
- Where the address of operator (&) cannot be used?
It cannot be used on constants.
It cannot be used on variable which are declared using register storage class.
- Is FILE a built-in data type?
- No, it is a structure defined in stdio.h.
- What is reminder for 5.0 % 2?
Error, It is invalid that either of the operands for the modulus operator (%) is a real number.
- How many operators are there under the category of ternary operators?
There is only one operator and is conditional operator (? : ).
- Which key word is used to perform unconditional branching?
goto
- What is a pointer to a function? Give the general syntax for the same.
A pointer holding the reference of the function is called pointer to a function. In general it is declared as follows.
Once fun_ptr refers a function the same can be invoked using the pointer as follows.
- Explain the use of comma operator (,).
Comma operator can be used to separate two or more expressions.
- What is a NULL statement?
A null statement is no executable statements such as ; (semicolon).
Above does nothing 10 times.
- What is a static function?
A function’s definition prefixed with static keyword is called as a static function. You would make a function static if it should be called only within the same source code.
- Which compiler switch to be used for compiling the programs using math library with gcc compiler?
Opiton –lm to be used as > gcc –lm <file.c>
- Which operator is used to continue the definition of macro in the next line?
Backward slash () is used.
- Which operator is used to receive the variable number of arguments for a function?
Ellipses (…) is used for the same. A general function definition looks as follows
- What is the problem with the following coding snippet?
s1 points to a string constant and cannot be altered.
- Which built-in library function can be used to re-size the allocated dynamic memory?
realloc().
- Define an array.
Array is collection of similar data items under a common name.
- What are enumerations?
Enumerations are list of integer constants with name. Enumerators are defined with the keyword enum.
- Which built-in function can be used to move the file pointer internally?
fseek()
- What is a variable?
A variable is the name storage.
- Who designed C programming language?
Dennis M Ritchie.
- C is successor of which programming language?
B
- What is the full form of ANSI?
American National Standards Institute.
- Which operator can be used to determine the size of a data type or variable?
sizeof
- Can we assign a float variable to a long integer variable?
Yes, with loss of fractional part.
- Is 068 a valid octal number?
No, it contains invalid octal digits.
- What it the return value of a relational operator if it returns any?
Return a value 1 if the relation between the expressions is true, else 0.
- How does bitwise operator XOR works.
If both the corresponding bits are same it gives 0 else 1.
- What is an infinite loop?
A loop executing repeatedly as the loop-expression always evaluates to true such as
- Can variables belonging to different scope have same name? If so show an example.
Variables belonging to different scope can have same name as in the following code snippet.
- What is the default value of local and global variables?
Local variables get garbage value and global variables get a value 0 by default.
- Can a pointer access the array?
Pointer by holding array’s base address can access the array.
- What are valid operations on pointers?
- Comparision ii) Addition/Substraction (excluding void pointers)
The only two permitted operations on pointers are
- What is a string length?
It is the count of character excluding the ‘0’ character.
- What is the built-in function to append one string to another?
strcat() form the header string.h
- Which operator can be used to access union elements if union variable is a pointer variable?
Arrow (->) operator.
- Explain about ‘stdin’.
stdin in a pointer variable which is by default opened for standard input device.
- Name a function which can be used to close the file stream.
fclose().
- What is the purpose of #undef preprocessor?
It be used to undefine an existing macro definition.
- Define a structure.
A structure can be defined of collection of heterogeneous data items.
- Name the predefined macro which be used to determine whether your compiler is ANSI standard or not?
__STDC__
- What is typecasting?
Typecasting is a way to convert a variable/constant from one type to another type.
- What is recursion?
Function calling itself is called as recursion.
- Which function can be used to release the dynamic allocated memory?
free().
- What is the first string in the argument vector w.r.t command line arguments?
Program name.
- How can we determine whether a file is successfully opened or not using fopen() function?
On failure fopen() returns NULL, otherwise opened successfully.
- What is the output file generated by the linker.
Linker generates the executable file.
- What is the maximum length of an identifier?
Ideally it is 32 characters and also implementation dependent.
- What is the default function call method?
By default the functions are called by value.
- Functions must and should be declared. Comment on this.
Function declaration is optional if the same is invoked after its definition.
- When the macros gets expanded?
At the time of preprocessing.
- Can a function return multiple values to the caller using return reserved word?
No, only one value can be returned to the caller.
- What is a constant pointer?
A pointer which is not allowed to be altered to hold another address after it is holding one.
- To make pointer generic for which date type it need to be declared?
Void
- Can the structure variable be initialized as soon as it is declared?
Yes, w.r.t the order of structure elements only.
- Is there a way to compare two structure variables?
There is no such. We need to compare element by element of the structure variables.
- Which built-in library function can be used to match a patter from the string?
Strstr()
- What is difference between far and near pointers?
In first place they are non-standard keywords. A near pointer can access only 2^15 memory space and far pointer can access 2^32 memory space. Both the keywords are implementation specific and are non-standard.
- Can we nest comments in a C code?
No, we cannot.
- Which control loop is recommended if you have to execute set of statements for fixed number of times?
for – Loop.
- What is a constant?
A value which cannot be modified is called so. Such variables are qualified with the keyword const.
- Can we use just the tag name of structures to declare the variables for the same?
No, we need to use both the keyword ‘struct’ and the tag name.
- Can the main() function left empty?
Yes, possibly the program doing nothing.
- Can one function call another?
Yes, any user defined function can call any function.
- Apart from Dennis Ritchie who the other person who contributed in design of C language.
Brain Kernighan
What is Next ?
Further you can go through your past assignments you have done with the subject and make sure you are able to speak confidently on them. If you are fresher then interviewer does not expect you will answer very complex questions, rather you have to make your basics concepts very strong.
Second it really doesn't matter much if you could not answer few questions but it matters that whatever you answered, you must have answered with confidence. So just feel confident during your interview. We at tutorialspoint wish you best luck to have a good interviewer and all the very best for your future endeavor. Cheers :-)
List of top 50 most frequently asked C Language multiple choice questions and answers pdf download free
1. Who is father of C Language?
A. Bjarne Stroustrup
B. Dennis Ritchie
C. James A. Gosling
D. Dr. E.F. Codd
Answer : B
2. C Language developed at _____?
A. AT & T’s Bell Laboratories of USA in 1972
B. AT & T’s Bell Laboratories of USA in 1970
C. Sun Microsystems in 1973
D. Cambridge University in 1972
Answer : A
3. For 16-bit compiler allowable range for integer constants is ______ ?
A. -3.4e38 to 3.4e38
B. -32767 to 32768
C. -32768 to 32767
D. -32668 to 32667
Answer : C
4. C programs are converted into machine language with the help of ______.
A. An Editor
B. A compiler
C. An operating system
D. None of the above
Answer : B
5. A C variable cannot start with
A. An alphabet
B. A number
C. A special symbol other than underscore
D. both (b) and (c)
Answer : D
6. Which of the following is allowed in a C Arithmetic instruction
A. []
B. {}
C. ()
D. None of the above
Answer : C
7. Which of the following shows the correct hierarchy of arithmetic operations in C
A. / + * –
B. * – / +
C. + – / *
D. * / + –
Answer : D
8. What is an array?
A. An array is a collection of variables that are of the dissimilar data type.
B. An array is a collection of variables that are of the same data type.
C. An array is not a collection of variables that are of the same data type.
D. None of the above.
Answer : B
9. What is right way to Initialization array?
A. int num[6] = { 2, 4, 12, 5, 45, 5 } ;
B. int n{} = { 2, 4, 12, 5, 45, 5 } ;
C. int n{6} = { 2, 4, 12 } ;
D. int n(6) = { 2, 4, 12, 5, 45, 5 } ;
Answer : A
10. An array elements are always stored in _________ memory locations.
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Answer : A
11. What is the right way to access value of structure variable book{ price, page }?
A. printf(“%d%d”, book.price, book.page);
B. printf(“%d%d”, price.book, page.book);
C. printf(“%d%d”, price::book, page::book);
D. printf(“%d%d”, price->book, page->book);
Answer : A
12. perror( ) function used to ?
A. Work same as printf()
B. prints the error message specified by the compiler
C. prints the garbage value assigned by the compiler
D. None of the above
Answer : B
13. Bitwise operators can operate upon?
A. double and chars
B. floats and doubles
C. ints and floats
D. ints and chars
Answer : D
14. What is C Tokens?
A. The smallest individual units of c program
B. The basic element recognized by the compiler
C. The largest individual units of program
D. A & B Both
Answer : D
15. What is Keywords?
A. Keywords have some predefine meanings and these meanings can be changed.
B. Keywords have some unknown meanings and these meanings cannot be changed.
C. Keywords have some predefine meanings and these meanings cannot be changed.
D. None of the above
Answer : C
16. What is constant?
A. Constants have fixed values that do not change during the execution of a program
B. Constants have fixed values that change during the execution of a program
C. Constants have unknown values that may be change during the execution of a program
D. None of the above
Answer : A
17. Which is the right way to declare constant in C?
A. int constant var =10;
B. int const var = 10;
C. const int var = 10;
D. B & C Both
Answer : D
18. Which operators are known as Ternary Operator?
A. ::, ?
B. ?, :
C. ?, ;;
D. None of the avobe
Answer : B
19. In switch statement, each case instance value must be _______?
A. Constant
B. Variable
C. Special Symbol
D. None of the avobe
Answer : A
20. What is the work of break keyword?
A. Halt execution of program
B. Restart execution of program
C. Exit from loop or switch statement
D. None of the avobe
Answer : C
21. What is function?
A. Function is a block of statements that perform some specific task.
B. Function is the fundamental modular unit. A function is usually designed to perform a specific task.
C. Function is a block of code that performs a specific task. It has a name and it is reusable
D. All the above
Answer : D
22. Which one of the following sentences is true ?
A. The body of a while loop is executed at least once.
B. The body of a do … while loop is executed at least once.
C. The body of a do … while loop is executed zero or more times.
D. A for loop can never be used in place of a while loop.
Answer : B
23. A binary tree with 27 nodes has _______ null branches.
A. 54
B. 27
C. 26
D. None of the above
Answer : D
24. Which one of the following is not a linear data structure?
A. Array
B. Binary Tree
C. Queue
D. Stack
Answer : B
25. Recursive functions are executed in a?
A. First In First Out Order
B. Load Balancing
C. Parallel Fashion
D. Last In First Out Order
Answer : D
26. Queue is a _____________ list.
A. LIFO
B. LILO
C. FILO
D. FIFO
Answer : D
27. The statement print f (“%d”, 10 ? 0 ? 5 : 1 : 12); will print?
A. 10
B. 0
C. 12
D. 1
Answer : D
28. To represent hierarchical relationship between elements, which data structure is suitable?
A. Priority
B. Tree
C. Dqueue
D. All of the above
Answer : B
29. Which of the following data structure is linear type?
A. Strings
B. Queue
C. Lists
D. All of the above
Answer : D
30. The statement printf(“%c”, 100); will print?
A. prints 100
B. print garbage
C. prints ASCII equivalent of 100
D. None of the above
Answer : C
C Language Questions And Answers Pdf Free Download
31. The _______ memory allocation function modifies the previous allocated space.
A. calloc
B. free
C. malloc
D. realloc
Answer : D
32. Number of binary trees formed with 5 nodes are
A. 30
B. 36
C. 108
D. 42
Answer : D
33. The “C” language is
A. Context free language
B. Context sensitive language
C. Regular language
D. None of the above
Answer : A
34. The worst case time complexity of AVL tree is better in comparison to binary search tree for
A. Search and Insert Operations
B. Search and Delete Operations
C. Insert and Delete Operations
D. Search, Insert and Delete Operations
Answer : D
35. In which tree, for every node the height of its left subtree and right subtree differ almost by one?
A. Binary search tree
B. AVL tree
C. Threaded Binary Tree
D. Complete Binary Tree
Answer : B
36. C is ______ Language?
A. Low Level
B. High Level
C. Assembly Level
D. Machine Level
37. The Default Parameter Passing Mechanism is called as
A. Call by Value
B. Call by Reference
C. Call by Address
D. Call by Name
Answer : A
38. What is Dequeue?
A. Elements can be added from front
B. Elements can be added to or removed from either the front or rear
C. Elements can be added from rear
D. None of the above
Answer : B
C Language Questions And Answers Pdf In Hindi
39. In which linked list last node address is null?
A. Doubly linked list
B. Circular list
C. Singly linked list
D. None of the above
Answer : C
40. Which is the correct syntax to declare constant pointer?
A. int *const constPtr;
B. *int constant constPtr;
C. const int *constPtr;
D. A and C both
Answer : D
1. What will be the output of the following arithmetic expression ?
5+3*2%10-8*6
a) -37
b) -42
c) -32
d) -28
Ans: a
2. What will be the output of the following statement ?
int a=10; printf(“%d &i”,a,10);
a) error
b) 10
c) 10 10
d) none of these
Ans: d
3. What will be the output of the following statement ?
printf(“%X%x%ci%x”,11,10,’s’,12);
a) error
b) basc
c) Bas94c
d) none of these
Ans: b
4. What will be the output of the following statements ?
int a = 4, b = 7,c; c = a = = b; printf(“%i”,c);
a) 0
b) error
c) 1
d) garbage value
Ans: a
5. What will be the output of the following statements ?
int a = 5, b = 2, c = 10, i = a>b
void main()
{ printf(“hello”); main(); }
a) 1
b) 2
c) infinite number of times
d) none of these
Ans: c
6. What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf(“%d %d %d”,s.p,s.c,s.m);
}
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
(d) Compiler error
(e) None of these
Ans: c
7. What will be the output of the following statements ?
int x[4] = {1,2,3}; printf(“%d %d %D”,x[3],x[2],x[1]);
a) 03%D
b) 000
c) 032
d) 321
Ans: c
8. What will be the output of the following statement ?
printf( 3 + “goodbye”);
a) goodbye
b) odbye
c) bye
d) dbye
Ans: d
C Language Questions And Answers Pdf
9. What will be the output of the following statements ?
long int a = scanf(“%ld%ld”,&a,&a); printf(“%ld”,a);
a) error
b) garbage value
c) 0
d) 2
Ans: b
10. What will be the output of the following program ?
#include
void main()
{ int a = 2;
switch(a)
{ case 1:
printf(“goodbye”); break;
case 2:
continue;
case 3:
printf(“bye”);
}
}
a) error
b) goodbye
c) bye
d) byegoodbye
Ans: a
11. What will be the output of the following statements ?
int i = 1,j; j=i— -2; printf(“%d”,j);
a) error
b) 2
c) 3
d) -3
Ans: c
12. What will be the output of following program ?
#include
main()
{
int x,y = 10;
x = y * NULL;
printf(“%d”,x);
}
a) error
b) 0
c) 10
d) garbage value
Ans: b
13. What will be the output of following statements ?
char x[ ] = “hello hi”; printf(“%d%d”,sizeof(*x),sizeof(x));
a) 88
b) 18
c) 29
d) 19
Ans: d
14. What will be the output of the following statements ?
int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf(“%d”,d);
a) 1
b) 2
c) 6
d) Error
Ans: d
15. What will be the output of the following statements ?
int i = 3;
printf(“%d%d”,i,i++);
a) 34
b) 43
c) 44
d) 33
Ans: b
16. What will be the output of the following program ?
#include
void main()
{
int a = 36, b = 9;
printf(“%d”,a>>a/b-2);
}
a) 9
b) 7
c) 5
d) none of these
Ans: a
17. int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
a) 11
b) 7
c) 5
d) 9
Ans: a
18. void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf(“EXAM”);
}
}
What is the output?
a) XAM is printed
b) exam is printed
c) Compiler Error
d) Nothing is printed
Ans: d
19. What is the output of the following code?
#include
void main()
{
int s=0;
while(s++<10)>
# define a 10
main()
{
printf(“%d..”,a);
foo();
printf(“%d”,a);
}
void foo()
{
#undef a
#define a 50
}
a) 10..10
b) 10..50
c) Error
d) 0
Ans: c
20. main()
{
struct
{
int i;
}xyz;
(*xyz)->i=10;
printf(“%d”,xyz.i);
}
What is the output of this program?
a) program will not compile
b) 10
c) god only knows
d) address of I
Ans: b
21.What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.
Ans: C
22. What would be the output of the following program?
#include
main()
{
char str[]=”S065AB”;
printf(“n%d”, sizeof(str));
}
a) 7
b) 6
c) 5
d) error
Ans: b
23. What will be the value of `a` after the following code is executed
#define square(x) x*x
a = square(2+3)
a) 25
b) 13
c) 11
d) 10
Ans: c
24. #include
void func()
{
int x = 0;
static int y = 0;
x++; y++;
printf( “%d — %dn”, x, y );
}
int main()
{
func();
func();
return 0;
}
What will the code above print when it is executed?
a)
1 — 1
1 — 1
b)
1 — 1
2 — 1
c)
1 — 1
2 — 2
d)
1 — 1
1 — 2
Ans: d
25. long factorial (long x)
{
????
return x * factorial(x – 1);
}
With what do you replace the ???? to make the function shown above return the correct answer?
a)
if (x 0) return 0;
b)
return 1;
c)
if (x >= 2) return 2;
d)
if (x <= 1) return 1;Ans: d26. int y[4] = {6, 7, 8, 9};int *ptr = y + 2; printf('%dn', ptr[ 1 ] );What is printed when the sample code above is executed?a) 6b) 7c) 8d) 9 Ans: d27. int i = 4;switch (i){default: ;case 3:i += 5;if ( i 8) {i++;if (i 9) break;i *= 2; } i -= 4; break; case 8:i += 5;break;}printf('i = %dn', i);What will the output of the sample code above be?a) i = 5b) i = 8c) i = 9d) i = 10Ans: a28. What will be output if you will compile and execute the following c code?void main(){if(printf('cquestionbank'))printf('I know c');elseprintf('I know c++');}(a) I know c(b) I know c++(c) cquestionbankI know c(d) cquestionbankI know c++(e) Compiler errorAnswer: (c)29.What will be output if you will compile and execute the following c code?#define call(x) #xvoid main(){printf('%s',call(c/c++));}(a)c(b)c++(c)#c/c++(d)c/c++(e)Compiler errorAnswer: (d)30. What will be output if you will compile and execute the following c code?#define message 'union ispower of c'void main(){clrscr();printf('%s',message);getch();}(a) union is power of c(b) union is power of c(c) union is Power of c(d) Compiler error(e) None of theseAnswer: (b)31. What will be output if you will compile and execute the following c code?void main(){int a=25;clrscr();printf('%o %x',a,a);getch();}(a) 25 25(b) 025 0x25(c) 12 42(d) 31 19(e) None of theseAnswer: (d)32. What will be output if you will compile and execute the following c code?void main(){int i=0;if(i0){i=((5,(i=3)),i=1);printf('%d',i);}elseprintf('equal'); }(a) 5(b) 3(c) 1(d) equal(e) None of aboveAnswer: (c)33.What will be output if you will compile and execute the following c code?int extern x;void main() printf('%d',x);x=2;getch();}int x=23;(a) 0(b) 2(c) 23(d) Compiler error(e) None of theseAnswer: (c)34.What will be output if you will compile and execute the following c code?void main(){int a,b;a=1,3,15;b=(2,4,6);clrscr();printf('%d ',a+b);getch();}(a) 3(b) 21(c) 17(d) 7 (e) Compiler errorAnswer: (d)35.What will be output if you will compile and execute the following c code?void main(){static main;int x;x=call(main);clrscr();printf('%d ',x);getch();}int call(int address){address++;return address;}(a) 0(b) 1(c) Garbage value(d) Compiler error(e) None of theseAnswer: (b)36. What will be output if you will compile and execute the following c code?#include 'string.h'void main(){clrscr();printf('%d %d',sizeof('string'),strlen('string'));getch();}(a) 6 6(b) 7 7(c) 6 7(d) 7 6 (e) None of theseAnswer: (d)37. Write c program which display mouse pointer and position of pointer.(In x coordinate, y coordinate)?Answer:#include”dos.h”#include”stdio.h”void main(){union REGS i,o;int x,y,k;//show mouse pointeri.x.ax=1;int86(0x33,&i,&o);while(!kbhit()) //its value will false when we hit key in the key board{i.x.ax=3; //get mouse positionx=o.x.cx;y=o.x.dx;clrscr();printf('(%d , %d)',x,y);delay(250);int86(0x33,&i,&o);}getch();}38.What will be output if you will compile and execute the following c code?void main(){int huge*p=(int huge*)0XC0563331;int huge*q=(int huge*)0xC2551341;*p=200;printf('%d',*q); }(a)0(b)Garbage value(c)null(d) 200(e)Compiler errorAnswer: (d)39.What will be output if you will compile and execute the following c code?struct marks{int p:3;int c:3;int m:2;};void main(){struct marks s={2,-6,5};printf('%d %d %d',s.p,s.c,s.m); }(a) 2 -6 5(b) 2 -6 1(c) 2 2 1(d) Compiler error(e) None of theseAnswer: (c)40.What will be output if you will compile and execute the following c code?void main(){if(printf('cquestionbank'))printf('I know c');elseprintf('I know c++');}(a) I know c(b) I know c++(c) cquestionbankI know c(d) cquestionbankI know c++(e) Compiler errorAnswer: (c)41.What will be output if you will compile and execute the following c code?#define call(x) #xvoid main(){printf('%s',call(c/c++));}(a)c(b)c++(c)#c/c++(d)c/c++(e)Compiler errorAnswer: (d)42. What will be output if you will compile and execute the following c code?#define message 'union ispower of c'void main(){clrscr();printf('%s',message);getch();}(a) union is power of c(b) union ispower of c(c) union isPower of c(d) Compiler error(e) None of theseAnswer: (b)43. What will be output if you will compile and execute the following c code?void main(){int a=25;clrscr();printf('%o %x',a,a);getch();}(a) 25 25(b) 025 0x25(c) 12 42(d) 31 19(e) None of theseAnswer: (d)44. What will be output if you will compile and execute the following c code?void main(){int i=0;if(i0){i=((5,(i=3)),i=1);printf('%d',i);}elseprintf('equal'); }(a) 5(b) 3(c) 1(d) equal(e) None of aboveAnswer: (c)45.What will be output if you will compile and execute the following c code?int extern x;void main() printf('%d',x);x=2;getch();}int x=23;(a) 0(b) 2(c) 23(d) Compiler error(e) None of theseAnswer: (c)46.What will be output if you will compile and execute the following c code?void main(){int a,b;a=1,3,15;b=(2,4,6);clrscr();printf('%d ',a+b);getch();}(a) 3(b) 21(c) 17(d) 7 (e) Compiler errorAnswer: (d)47.What will be output if you will compile and execute the following c code?void main(){static main;int x;x=call(main);clrscr();printf('%d ',x);getch();}int call(int address){address++;return address;}(a) 0(b) 1(c) Garbage value(d) Compiler error(e) None of theseAnswer: (b)48.What will be output if you will compile and execute the following c code?#include 'string.h'void main(){clrscr();printf('%d %d',sizeof('string'),strlen('string'));getch();}(a) 6 6(b) 7 7(c) 6 7(d) 7 6 (e) None of theseAnswer: (d)49.What will be output if you will compile and execute the following c code?void main(){int huge*p=(int huge*)0XC0563331;int huge*q=(int huge*)0xC2551341;*p=200;printf('%d',*q); }(a)0(b)Garbage value(c)null(d) 200(e)Compiler errorAnswer: (d)50.What will be output if you will compile and execute the following c code?struct marks{int p:3;int c:3;int m:2;};void main(){struct marks s={2,-6,5};printf('%d %d %d',s.p,s.c,s.m); }(a) 2 -6 5(b) 2 -6 1(c) 2 2 1(d) Compiler error(e) None of theseAnswer: (c)