Visit our website
Download KG App
SANCHIT SIR YASH SIR
PROGRAMMING DAILY PRACTICE PAPER 17
1. What will be the output of following code :
// Assume all header files are included
void main(){
int const * p=5;
printf("%d",++(*p));
}
A.5
B. 6
C. 0
D. Compilation Error
[ELITMUS 2019]
2. What will be the output of following code :
// Assume all header files are included
main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
Learn all about Python Programming
University Exam Preparation Course
VINAY SIR SANCHIT SIR
A. “I love You”
B. “I hated U”
C. “I hate U”
D. Runtime Error
[AMCAT 2020]
3. What will be the output of following code :
// Assume all header files are included
main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
A. 1 3 2 5 8
B. 5 4 3 2 1
C. 5 8 9 6 4
D. Runtime Error
[HEXAWARE 2019]
4. What will be the output of following code :
// Assume all header files are included
main()
{
extern int i;
Learn all about Python Programming
University Exam Preparation Course
VINAY SIR SANCHIT SIR
i=20;
printf("%d",i);
}
A. 20
B. Linker Error : Undefined symbol ‘_i
C. 19
D. Runtime Error
[TCS 2020]
5. What will be the output of following code :
// Assume all header files are included
main()
{
int c=- -2;
printf("c=%d",c);
}
A. c=2;
B. c=-2;
C. c=++2;
D. Runtime Error
[WIPRO 2020]
Learn all about Python Programming
University Exam Preparation Course
VINAY SIR SANCHIT SIR
ANSWERS
1 (D) 2 (C) 3 (B) 4 (B) 5 (A)
Ans. D
Explanation :
p is a pointer to a “constant integer”. But we tried to change the value of the constant
integer.
Ans. c
Explanation : Float takes 4 bytes and long double takes 10 bytes. So float stores
0.9 with less precision than long double.
Ans. b
Explanation : When static storage class is given, it is initialized once. The change
in the value of a static variable is retained even between the function calls. Main
is also treated like any other ordinary function, which can be called recursively.
Ans. b
Explanation : extern int i; specifies to the compiler that the memory for i is
allocated in some other program and thataddress will be given to the current
program at the time of linking
Ans. a
Explanation : Here unary minus (or negation) operator is used twice. Same maths
rules applies, ie. minus * minus= plus.
Resume Preparation Training course
Interview Preparation course
YASH SIR SANCHIT SIR
To get 10% discount on GATE 2022 Full
course,
Use referral code
KGYT
on
SUBSCRIBE FOR FULL
COURSE
Telegram group links
Placement group GATE discussion group
VISIT OUR WEBSITE
YASH SIR SANCHIT SIR