[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Basic Concepts - Discussion

Home > C Programming > Basic Concepts > MCQs Questions Discussion

38 / 90

What will be output of the following "c" code?

#include<stdio.h>

void main() {
printf("ABCDEFG \n");
printf(4+"ABCDEFG\n");
printf("ABCDEFG\n"+4);
printf("%c\n", "ABCDEFG" [4]);
printf("%c\n", 4["ABCDEFG"]);
}

AABCDEFG EFG EFG E E

BCompilation Error

CNo output No Error

DABCDEFG ABCDEFG ABCDEFG ABCDEFG ABCDEFG

Answer: Option (Login/Signup)

Show Explanation

Line 4 and 5 will result to the same output, i.e, it will print the characters from 4th index to (n-1)th index or 6th index. Hence, printing EFG for both the lines.

Line 6 and 7 will also result to the same output, i.e, it will print the character at 4th index position. Hence, printing E for both the lines.

Hence, the output will be ABCDEFG EFG EFG E E.  

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here