Computer Science · C Programming
Which of the following statements is most appropriate for the C code given below? int tryThis(char s[]) { int c1 = 0, c2 = 0, i = 0; for (i = 0; s[i]; i++) { if (i % 2 == 0) c1++; else c2++; } return c1 - c2; } int main() { if (!tryThis('Palindromes')) printf('even'); else printf('odd'); }
- 1The output of the program will be 'odd'.✓
- 2The output of the program will be 'even'.
- 3The program will not display anything as the for loop is infinite.
- 4The program will not compile as the condition in the for loop is not specified properly.
Correct answer
The output of the program will be 'odd'.
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on C Programming?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · C Programming