UGC NET CS 2010 June-Paper-2
October 18, 2023
Boolean-Algebra
October 19, 2023
UGC NET CS 2010 June-Paper-2
October 18, 2023
Boolean-Algebra
October 19, 2023

GATE 2011

Question 10

What does the following fragment of C-program print?

char c[] = "GATE2011";
char *p =c;
printf("%s", p + p[3] - p[1]) ; 
A
GATE2011
B
E2011
C
2011
D
011
Question 10 Explanation: 
p is the starting address of array.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
Correct Answer: C
Question 10 Explanation: 
p is the starting address of array.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
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!!