Visit our website
Download KG App
SANCHIT SIR YASH SIR
PROGRAMMING DAILY PRACTICE PAPER 3
Q1. Given the following statement, what will be displayed on the screen?
1. int * aPtr;
2. *aPtr = 100;
3. cout << *aPtr + 2;
a. 100
b. 102
c. 104
d. 108
(Topic – C programming)
(Asked in Gate 2014)
Q2. Which of these will happen if recursive method does not have a base case?
a) An infinite loop occurs
b) System stops the program after some time
c) After 1000000 calls it will be automatically stopped
d) None of the mentioned
(Topic – Java Programming)
(Asked in Microsoft 2012)
TCS NQT Superset course
Programming Course for Placements, GATE and Interview
SANCHIT SIR YASH SIR
Q3. What will be the output of the following pseudocode?
Integer arr[]={10, 20, 30, 40, 5}
Integer a, s
Set s = 0
Set a = arr[1] + arr[2]
Print a
A) 25
B) 5
C) 50
D) 40
(Topic – Pseudo Code)
(Asked in Capgemini 2002)
Q4. Which is more effective while calling the functions?
a) call by value
b) call by reference
c) call by pointer
d) call by object
(Topic – C++ programming)
(Asked in Amazon 2004)
Learn all about Python Programming
University Exam Preparation Course
VINAY SIR SANCHIT SIR
Q5. Will the following C code compile without any error?
#include <stdio.h>
int main()
int k;
int k;
for (k = 0; k < 10; k++);
a) Yes
b) No
c) Depends on the compiler
d) Depends on the C standard implemented by compilers
(Topic – C programming )
(Asked in TCS 2012)
Competitive Programming for beginners
Top 20 Coding questions for placements
SANCHIT SIR CHIRAYU SIR
ANSWER KEY
S.No 1 2 3 4 5
Correct Opt b a c b a
SOLUTIONS -
1. Answer: (b)
102 Explanation: aPtr is an integer pointer which value is 100.
= *aPtr + 2
= 100 + 2
= 102
2. Answer: a
Explanation: If a recursive method does not have a base case then an infinite loop occurs
which results in Stack Overflow.
3. Ans: c
Explanation:
There is an array of integer arr[]={10,20,30,40,50}. There are two variables a and b
declared. .
Resume Preparation Training course
Interview Preparation course
YASH SIR SANCHIT SIR
The value initialized for s is 0. On the next line adding the 1st index value 20 and 2nd index
value 30 arr[1] + arr[2]( 20+30), the answer is 50 will be stored in a. Finally printing the
updated values of a is 50.
4. Answer: b
Explanation: In the call by reference, it will just passes the reference of the memory
addresses of passed values rather than copying the value to new memories which reduces
the overall time and memory use..
5. Answer: a
Explanation: There can be blocks inside the block. But within a block, variables have only
block scope.
Check FREE classes for GATE2022 on unacademy
Subscribe to Unacademy PLUS full course for GATE 2022
To get 10% discount on GATE 2022 Full
Use referral code
KGYT
on
SUBSCRIBE FOR FULL COURSE
Telegram group links
Placement group GATE discussion group
VISIT OUR WEBSITE
YASH SIR SANCHIT SIR