...
Question 3762 – UGC NET CS 2015 Jun- paper-2
May 9, 2024
Question 42 – Software-Engineering
May 10, 2024
Question 3762 – UGC NET CS 2015 Jun- paper-2
May 9, 2024
Question 42 – Software-Engineering
May 10, 2024

Question 3814 – UGC NET CS 2015 Jun- paper-2

What is the output of the following program?
(Assume that the appropriate preprocessor directives are included and there is no syntax error)
main( )
{
char S[ ] = “ABCDEFGH”;
printf (“%C”, *(&S[3]));
printf (“%s”, S+4);
printf (“%u”, S);
/* Base address of S is 1000 */
}

Correct Answer: D

Question 11 Explanation: 
Step-1: String is stored in appropriate location is

Step-2: printf (“%C”, *(&S[3]));
This statement will print character ‘D’
(&S[3]) → Will print address of index 3
*(&S[3]) → will print value in index 3. The value is nothing but ‘D’.
Step-3: printf (“%s”, S+4); /* will print characters ‘EFGH’ */
Because previous S value index position is 3. Now we are performing +4 operations. It will print EFGH. we are given escape sequence is String.
Step-4: printf (“%u”, S); → It will print address of S. The base address given as S is 1000.
A
ABCDEFGH1000
B
CDEFGH1000
C
DDEFGHH1000
D
DEFGH1000
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!