1.

The following are function calling statements. Some of them will be executed, while some other generate compilation error. Write down your opinion on each of them with proper justification Function 1. har ch = 2. sqrt(25); 3. strcat (“Computer”, “Program”); 4. double num = pow(2,3,5) 5. putchar(getchar());

Answer»

1. getch get a character from the console(keyboard) but does not echo to the screen. So we can’t read a character from the console. 

2. It returns the square root of 25. 

3. It concatenates Program to computer, i.e. we will get a string “computer program”

4. The function pow should contains only two arguments. But here it contains 3 arguments so it is an error. We can write this function as follows Double num = pow(pow(2,3),5) 

5. It reads a character from the console and display it on the screen.



Discussion

No Comment Found

Related InterviewSolutions