Upload
mohammed-jawad
View
217
Download
0
Embed Size (px)
Citation preview
8/12/2019 HCL PAPER1
1/6
PAPER: HCL Placement Paper (C- Programming)
C Programming
1. Which of the following abot the following two !eclaration i" tre
i ) int #$()
ii) int (#$)()
Choice :
a) %oth are i!enticalb) &he fir"t i" a correct !eclaration an! the "econ! i" wrong
c) &he fir"t !eclaration i" a fnction retrning a pointer to an integer an! the "econ! i" a
pointer to fnction retrning int
!) %oth are !ifferent wa'" of !eclaring pointer to a fnction
An"wer : c) &he fir"t !e...
. What are the ale" printe! b' the following program*
+!efine !print(e,pr) printf(+e,pr /!0ne,pr)
main()
2
int ,34int '54
!printf(,6')4
7
Choice:a) + b) e,pr c) ,6' !) none
An"wer: c),6'
5. Which of the following i" tre of the following program
main()
2char #c4
int #ip4
c (char #)malloc(188)4ip(int #)c4
free(ip)4
7An": &he co!e fnction" properl' relea"ing all the memor' allocate!
9.otpt of the following.
main()
2
8/12/2019 HCL PAPER1
2/6
int i4
char #p4
i8; c) !) a=1; e) ?one
An"wer : >
8/12/2019 HCL PAPER1
3/6
2
int n4
printf(/! /!0n ==n n#n)47
a) 5 b) 59 c) 9 !) cannot !etermine
An"wer : b) 59
11. What i" the otpt of the following program*
int , 8,>4
main()
2char ,4
printf(/!0n,)
7
a) compilation error b) GAG c) > !) ni!entifie!
an". !)
1. What i" the otpt of the following program
main()2
int a184
int b4
if(a5)
b==4printf(/! /!0nab==)4
7
a) 18 b)183 c) 5 !) 53 e)
none
An"wer : !) 53
15. What can be "ai! of the following program*
main()2
enm onth" 2IA? 1$E%ARAPR74
onth" IA?4if(1)
2
printf(Ian i" the fir"t month)4
7
8/12/2019 HCL PAPER1
4/6
8/12/2019 HCL PAPER1
5/6
2
int ,84
int '184"wap(,')4
printf(/! /!',=)4
7"wap(int ,int ')
2
int temp4temp ,4
,'4
'temp4
7
a)188 b) 81 c) 18 !)18
e)none
An"wer:!)18
13. What i" the otpt of the following problem *
+!efine ?C() ==
main()
2int 94
printf(/!?C(==))4
7
a)9 b)> c) !)compilation error e) rntime
error
An"wer : !) compilation error no ==== operator allowe!
1;. what can be "ai! of the following
"trct ?o!e 2
char #wor!4int cont4
"trct ?o!e left4
"trct ?o!e right47
a) ncorrect !efinitionb) "trctre" cannot refer to other "trctre
c) @trctre" can refer to them"ele". Hence the "tatement i" O
!) @trctre" can refer to ma,imm of one other "trctre
8/12/2019 HCL PAPER1
6/6
An"wer :c)
1.18")!) ?one of the aboe
An": b.) total 1> "pace" an! print onl' 18 character".