Choose the correct option to fill ?1 and ?2 so that the program below prints an input string in reverse order. Assume that the input string is terminated by a newline character.
void reverse(void) { int c; if (?1) reverse(); ?2 } int main() { printf ("Enter Text ") ; printf ("\n") ; reverse(); printf ("\n") ; } |
chevron_right
filter_none
(A)
?1 is (getchar() != ’\n’) ?2 is getchar(c);
(B)
?1 is (c = getchar() ) != ’\n’) ?2 is getchar(c);
(C)
?1 is (c != ’\n’) ?2 is putchar(c);
(D)
?1 is ((c = getchar()) != ’\n’) ?2 is putchar(c);
Answer: (D)
Explanation: See Question 2 of https://www.geeksforgeeks.org/c-language-set-5/
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2008 | Question 1
- GATE | GATE CS 2008 | Question 2
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 4
- GATE | GATE CS 2008 | Question 5
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 8
- GATE | GATE CS 2008 | Question 9
- GATE | GATE CS 2008 | Question 10
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 12
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 14
- GATE | GATE CS 2008 | Question 15
- GATE | GATE CS 2008 | Question 16
- GATE | GATE CS 2008 | Question 17
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 85
- GATE | GATE CS 2008 | Question 20

