Saturday, July 13, 2013

Frequently Asked Questions and Answers for Software Comapny Interviews in C Programming Language|Viva voce|Technical|Campus Recruitment

If you want to get placed in software companies after your B.Tech/Engineering degree education, you must be handy with programming languages. C is the pioneer of many programming languages namely C#, D, Go, Rust, Java, JavaScript, Limbo, LPC, Perl, PHP, Python, and Unix's C shell. It's essential to know the simple one word answers to the most frequently asked questions in interviews. Remember, interviewers often test your basic knowledge before leaping into advanced problems.

1. Which are the derived data-types in C?
Ans: Function, Array and Pointer.

2. What is size of long double in x86 architecture?
Ans: 80 bits 

3. What is the origin of short int?
Ans: In earlier days memory was very expensive. If the number being used is less than 128, then 1 byte was sufficient. Therefore, instead of using int, short int(8 bits) was used thereby saving memory.

4. What does the following mean in a C program?
expression1? expression2:expression3
Ans: If expression1 is true, expression2 is taken, otherwise expression3 is taken.

5. Distinguish between Lvalue and Rvalue?
Ans: The address associated with a program variable in C is called its Lvalue and the contents at that location are its Rvalue.

6. What would a=printf("Good") return?
Ans: Good4 
It assigns a with the number of bytes printed. Here it's four.

7. What does \r mean in a C program?
Ans: Linefeed(Linebreak)

8. To which value does C equate !2 to?
Ans: zero.
! any value except zero =0

9. What would ++(x+y) would return?
Ans: Compiler error.
This happens because ++(x+y) means x+y=(x+y)+1.
Expressions are not allowed on the Left Hand Side(LHS).

10. What would be the result of 8 && 3?
Ans: 1.
&& refers to 'logical AND'.
In logical operation, any value other than zero is considered TRUE(1).
So, TRUE && TRUE ='1'.