1) Legal 2) Legal 3) Legal 4) Legal But Not Advised 5) Illegal: Contains
1) Legal 2) Legal 3) Legal 4) Legal But Not Advised 5) Illegal: Contains
1) Legal 2) Legal 3) Legal 4) Legal But Not Advised 5) Illegal: Contains
15. Option 2 16. 77 17. Option 1 18. rtcent rtcent lexthonity 20. 21. complier
error
22. Answer : 2 2 2 2
Explanation:The pointer to any type is of same size.
24. Answer: No
Explanation:When the declaration, typedef struct a aType; is encountered body of struct
a is not known. This is known as ‘incomplete types’. So creating a variable of incomplete
type is not possible. Because the memory needed for that variable will be unknown.
25. Answer: Compiler Error: Undefined structure date
Explanation: Only declaration of struct date is available inside the structure definition of
‘student’ but to have a variable of type struct date the definition of the structure is
required.
26. Answer: 770
Explanation: The integer value 256 in binary notation is: 00000001 00000010. It is
stored in memory (small-endian) as:00000010 00000001 Result of the expression *++ptr
= 3 makes the memory representation as: 00000010 00000011. So the integer
corresponding to it is 00000011 00000010 => 770.
27. Answer: 21
28. Answer: 10
Explanation:The size of integer array of 10 elements is 10 * sizeof(int). The macro
expands to sizeof(arr)/sizeof(int) => 10 * sizeof(int) / sizeof(int) => 10.
29. Answer: 1
Explanation: Arrays cannot be passed to functions as arguments and only the pointers
can be passed. So the argument is equivalent to int * array (this is one of the very few
places where [] and * usage are equivalent). The return statement becomes, sizeof(int *)/
sizeof(int) that happens to be equal in this case.
explanation
for question 17.
ptr= 3000
3003 3002 3001
8000 8001 8002 8003
both “ptr” and “s” are character pointers.
So the address increases by 1.
Now p=ptr.
Ie. p=8000.
*++p means post increment of p.
after this line gets executes the value of p=8001
printf("%s",*--*++p + 3);
in this sentence ++p=8002
*(8002) = 3001
--(3001) = 3000;
*(3000)=3500;
3500+3=3503
this points to “c” of the “black”
therefore printf(“%s”,3503) will print from “c” till “\0”. Hence the o/p “ck”.
3000 3001
p=3000;
printf("%s ",++*p);
printf("%s ",*p++);
printf(“%s”,*(3501));
hence once again prints “rtcent”.. because the pointer is still pointing the “r” of
"Artcent”.
After this line gets executed, now the pointer “p” gets incremented by 1.(because
its post increment).
Now the pointer becomes p=3001;
printf("%s ",++*p);
printf(“%s” ,++(*3001));
printf(“%s”,++(4500));
printf(“%s”,4501);
so it starts printing from “l” of “Flexthonity” till “\0”. Thus the output will be
“lexthonity”