Q.1 What Is The Output Of this program?
a) 10 2 10 2
b) 12 2 14 2
c) 12 3 14 3
d) 12 2 14 3
Answer : b
Explanation : In this program, in main() we pass two values x or y in fun() and fun() received the reference of x so increment it’s value but y have incremented but not a reference so y is same in main block.
Q.2 What Is The Output Of this program?
a) 25 30 35 20
b) 20 25 30 20
c) 25 30 25 30
d) 20 25 30 30
Answer : d
Explanation : In this program, main() call the f1() and pass the value of n in f1() and f1() is received the reference of n and increments 10 of it’s value now n is 30. Again call f2() and pass the value of m in f2(), f2() receive the value of m and check the condition and print the value.
Q.3 What Is The Output Of this program?
Answer : b
Explanation : In main(), call a fun() and pass string and one integer is 2. In fun(), loop i is iterated and check the condition if i is Even then decrease index value by 2 and if i is odd then increase by 2.
Q.4 What Is The Output Of this program?
a) 110 56 32 26
b) 110 57 30 27
c) 110 56 32 25
d) 100 55 30 25
Answer : a
Explanation : In this program, a pointer p contains a base address of array x so *p contain a value of x and p++ is pointing address of next element.
Q.5 What Is The Output Of this program?
a) 10 EEKSFORGEEK
b) 15 GEEKSFORGEEK
c) 15 EEKSFORGEEK
d) 10 GEEKSFORGEEK
Answer : C
Explanation : In this, the str contain a base address of string and pointer p contain a base address of array. If string and pointer is incremented by 1 – it’s pointing the next address value of string and array.
This article is contributed by Gyayak jain . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.