C Programming: Objective Questions and answers

These are the questions asked in various companies, for freshers (BCA, MCA).
If you are going for technical interview of IT Company then you must be prepare for these questions.
Here are List of Questions with answers.




1. In which numbering system can the binary number 1011011111000101 be easily converted to?

A. Decimal system
B. Hexadecimal system
C. Octal system
D. No need to convert

Answer & Explanation
Answer: Option B

Explanation:

Hexadecimal system is better, because each 4-digit binary represents one Hexadecimal digit.


2.If the two strings are identical, then strcmp() function returns

A. -1
B. 1
C. 0
D. Yes

Answer & Explanation
Answer: Option C

Explanation:

Declaration: strcmp(const char *s1, const char*s2);

The strcmp return an int value that is

if s1 < s2 returns a value < 0

if s1 == s2 returns 0

if s1 > s2 returns a value > 0


3. How will you print \n on the screen?

A. printf("\n");
B. echo "\\n";
C. printf('\n');
D. printf("\\n");

Answer & Explanation
Answer: Option D

Explanation:

The statement printf("\\n"); prints '\n' on the screen.

4. Which header file should be included to use functions like malloc() and calloc()?

A. memory.h
B. stdlib.h
C. string.h
D. dos.h
Answer & Explanation
Answer: Option B


5. What function should be used to free the memory allocated by calloc() ?

A. dealloc();
B. malloc(variable_name, 0)
C. free();
D. memalloc(variable_name, 0)

Answer: Option C


2 comments:

We are here to listen you, Comment your valueable opinion...!!!