SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
1.
ans: (a)
reason:
you cannot declare structure as unsized array.
2.
ans: (b)
reason:
The return st.. returns x value first as it is and then
decrements its value.
Its post decrement.
3.
ans: (e)
reason:
%p represents the pointer format specifier. It prints the
value in
hexa decimal upto four digits
4.
ans: (b)
5.
ans: (b)
reason:
The values in the if st.. () is said to be in the stack. So
the last element
in the stack is taken as check value(zero/non-zero). Here TRUE
is -1 i.e.
success stateand x+y is printed.
6.
/* Unsolved*/
7.
ans: (c)
reason:
Static initializes all to 0.
8.
ans: (b)
reason:
char pointer size = 1
int pointer size = 2
9.
ans: (d)
reason:
10.
ans: (c)
reason:
printf returns the total no.. of characters it prints on the
screen.
11.
ans: (c)
unsolved*/
12.
reason:
;;; doesnot matter. This indicates only an empty statement.
The o/p will be 3,1.
13.
ans: (b)
14.
ans: (d)
reason:
The puts prints and places the cursor in the next line,
whereas
the printf prints and places the cursor in the same line.
15.
ans: (c)
reason:
You need to put '=' sign at show. ie the correct st.. is
end=(char*)(show=(char*)strcpy(start,"MISPIS,"));
or else expression error.
16.
ans: (e)
reason:
The _fastcall keyword is reserved for
programming under Windows and OS/2.
17.
ans: (a)
reason:
The strcmp returns 0 if zone==target, If 0 the ?: assigns fail
st.. i.e. 0.
This is false value for IF st.. and hence else part is
executed.
18.
ans: (c)
reason:
t1 is an array. So you need to specify the subscript value
while
you assign any element to it.
char *t1; t1="craft" is correct since *t1 is a pointer and it
points
to the starting addr.. of the craft.
19.
ans: (b).
unsolved
20.
ans: (b)
21.
ans: (a)
reason:
Its a static array.
22.
ans: (b)
unsolved
23.
ans : (a)
24.
ans: (d)
25.
ans: (c)
reason:
c+ +100 is not valid as c=c+100
26.
ans: (d)
27.
ans: (a)
28.
ans: (b)
29.
ans: (a)
30.
ans:(c)
31.
ans: (d)
32.
ans: (e)
reason: incompatiable type conversions
33.
ans: (c)
reason: odd no.. AND with 1 gives TRUE value always.
34.
ans:
(b)
reason:
if we mention the string as two dimentional(for more than
one dim)
array with in printf statement,then we should give
'&'symbol
35.
ans: (b)
reason:
res=0+1/5;
res=1/5+1/4;
res=1/5+1/4+1/3;
....
res=1/5+1/4+1/3+1/2+1/1;
At last time
res=1/5+1/4+1/3+1/2+1/1+1/0;
^
|
zero divide occur
36.
ans: (b)
reason:
'%c' mainly used for print one charactor
We can't specify formate output within '%c'
37.
ans: (b)
reason:
can not modify constant value .
It is a fixed value for entire program.
38.
ans: (b)
reason:
'argc' holds number of arguments.
argc consist always value 1 becase file name is one of the
input .
therefore 1<1 gives false whereas 1==1 gives true.
39.
ans: (a)
reason:
% followed by non-format specifier is printed as such
with % symbol
40.
ans : (b)
reason: if no format specifier is given immediately after the
first appearance of % then the characters after the % are
printed as such
41.
ans: (d)
reason:
the scanf must have &x,&y for %d format specifiers.
42.
ans: (a)
reason:
In if statement, x=6 is assigned and not checked.
43.
ans: (d)
reason: self
44.
ans: (a)
reason: odometer principle, since a is unsigned it is always
+ve
45.
ans: (a)
reason: self
46.
ans: (e)
reason: unsolved
47.
ans: (c)
reason: x will contain the garbage value hence default
48.
ans: (b)
reason: x will contain the garbage value hence default
49.
ans: (b)
reason: self
50.
ans: (b)
reason: self
51.
ans: (b)
reason: recursive function
52.
ans: (d)
reason: t is a pointer and memory allocation is not needed for
that.
53.
ans: (a)
reason: Each 0 bit in the operand is set to 1, and each 1 bit
in the operand is set to 0 if we use ~
54.
ans: (c)
reason: int x:8 will get only first 8 bits assigned to it ie.,
1 byte of size
int x:9 will get only first 9 bits assigned to it ie., 2 byte
of size
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
x : 8 a a a a a a a a n n n n n n n n
x : 9 a a a a a a a a a n n n n n n n
--------------- ----------------------
1 byte 1 byte
55.
ans: (e)
reason:
56.
ans: (b)
reason: self
57.
ans: (d)
reason: self
58.
ans: (a)
reason: can't understand
59.
ans: (b)
reason: self
60.
ans: (c)
reason:
61.
ans: (1)
reason: self
62.
ans: (b)
63.
ans: (c)
64.
ans: (a)
65.
ans:(c)
66.
ans: (f)
67.
ans: (b)
reason : if you give int main() it goes to infinite loop.
68.
ans: (d)
69.
ans: (b)
70.
ans: (b)
71.
ans: (c)
72.
ans: (e)
73.
ans: (b)
reason: if name is given the output is hai
74.
ans: (a)
75.
ans: (b)
76.
ans: (a)
77.
ans: (c)
78.
ans: (c)
79.
ans: (a)
80.
ans: (a)
81.
82.
ans: (d)
reason : pointers cannot be added
83.
ans: (d)
84.
ans: (b)
reason: stack concept
85.
ans: (b)
86.
ans: (a)
87.
ans: (c)
88.
ans: (c)
89.
ans: (a)
90.
ans: (a)
91.
92.
93.
ans:(c)
94.
ans: (d)
reason: message[] is correct
95.
ans: (c)
reason: static is not allowed in main(..). If removed, junk
value.
96.
ans: (a)
reason: self
97.
ans: (b)
reason:
98.
ans: (a)
99.
ans: (b)
reason:
100.
ans: (c)
reason: *_ is an allowed variable

Contenu connexe

Tendances

Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questionsGradeup
 
[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++Muhammad Hammad Waseem
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02CIMAP
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsDhivyaSubramaniyam
 
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3Philip Schwarz
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework HelpC++ Homework Help
 
[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to PointersMuhammad Hammad Waseem
 

Tendances (19)

Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
[ITP - Lecture 15] Arrays & its Types
[ITP - Lecture 15] Arrays & its Types[ITP - Lecture 15] Arrays & its Types
[ITP - Lecture 15] Arrays & its Types
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
 
Programming Homework Help
Programming Homework Help Programming Homework Help
Programming Homework Help
 
[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 
C Assignment Help
C Assignment HelpC Assignment Help
C Assignment Help
 
Lecture 18 - Pointers
Lecture 18 - PointersLecture 18 - Pointers
Lecture 18 - Pointers
 
Python basics
Python basicsPython basics
Python basics
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
 
Strings
StringsStrings
Strings
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework Help
 
[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers
 

En vedette

C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013srikanthreddy004
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparationKushaal Singla
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
 
C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answersDeepak Singh
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answerlavparmar007
 
Geometry formula sheet
Geometry formula sheetGeometry formula sheet
Geometry formula sheetsidraqasim99
 
Geometry formula-sheet
Geometry formula-sheetGeometry formula-sheet
Geometry formula-sheetadheera dra
 
Probability Formula sheet
Probability Formula sheetProbability Formula sheet
Probability Formula sheetHaris Hassan
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematicsRagulan Dev
 
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...paijayant
 

En vedette (14)

C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparation
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answers
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
Cat Quant Cheat Sheet
Cat Quant Cheat SheetCat Quant Cheat Sheet
Cat Quant Cheat Sheet
 
C interview Question and Answer
C interview Question and AnswerC interview Question and Answer
C interview Question and Answer
 
Geometry formula sheet
Geometry formula sheetGeometry formula sheet
Geometry formula sheet
 
Algebra formulas
Algebra formulas Algebra formulas
Algebra formulas
 
Geometry formula-sheet
Geometry formula-sheetGeometry formula-sheet
Geometry formula-sheet
 
Probability Formula sheet
Probability Formula sheetProbability Formula sheet
Probability Formula sheet
 
Appeal format.depttl. appeals
Appeal format.depttl. appealsAppeal format.depttl. appeals
Appeal format.depttl. appeals
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematics
 
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
 

Similaire à 100 c interview questions answers

Similaire à 100 c interview questions answers (20)

(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2
 
Revision1 C programming
Revision1 C programmingRevision1 C programming
Revision1 C programming
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 
Ques c++ minhnd
Ques c++   minhndQues c++   minhnd
Ques c++ minhnd
 
algo1
algo1algo1
algo1
 
1.2 matlab numerical data
1.2  matlab numerical data1.2  matlab numerical data
1.2 matlab numerical data
 
Aman 2015
Aman 2015Aman 2015
Aman 2015
 
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
3rd Semester Computer Science and Engineering  (ACU-2022) Question papers3rd Semester Computer Science and Engineering  (ACU-2022) Question papers
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
Cs101 endsem 2014
Cs101 endsem 2014Cs101 endsem 2014
Cs101 endsem 2014
 
Cpl
CplCpl
Cpl
 
Midterm
MidtermMidterm
Midterm
 
Aman 2019
Aman 2019Aman 2019
Aman 2019
 
Lecture 15_Strings and Dynamic Memory Allocation.pptx
Lecture 15_Strings and  Dynamic Memory Allocation.pptxLecture 15_Strings and  Dynamic Memory Allocation.pptx
Lecture 15_Strings and Dynamic Memory Allocation.pptx
 
Project2
Project2Project2
Project2
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework Help
 
14 arrays
14 arrays14 arrays
14 arrays
 

100 c interview questions answers

  • 1. 1. ans: (a) reason: you cannot declare structure as unsized array. 2. ans: (b) reason: The return st.. returns x value first as it is and then decrements its value. Its post decrement. 3. ans: (e) reason: %p represents the pointer format specifier. It prints the value in hexa decimal upto four digits 4. ans: (b) 5. ans: (b) reason: The values in the if st.. () is said to be in the stack. So the last element in the stack is taken as check value(zero/non-zero). Here TRUE is -1 i.e. success stateand x+y is printed. 6. /* Unsolved*/ 7. ans: (c) reason: Static initializes all to 0. 8.
  • 2. ans: (b) reason: char pointer size = 1 int pointer size = 2 9. ans: (d) reason: 10. ans: (c) reason: printf returns the total no.. of characters it prints on the screen. 11. ans: (c) unsolved*/ 12. reason: ;;; doesnot matter. This indicates only an empty statement. The o/p will be 3,1. 13. ans: (b) 14. ans: (d) reason: The puts prints and places the cursor in the next line, whereas the printf prints and places the cursor in the same line. 15. ans: (c) reason: You need to put '=' sign at show. ie the correct st.. is end=(char*)(show=(char*)strcpy(start,"MISPIS,")); or else expression error.
  • 3. 16. ans: (e) reason: The _fastcall keyword is reserved for programming under Windows and OS/2. 17. ans: (a) reason: The strcmp returns 0 if zone==target, If 0 the ?: assigns fail st.. i.e. 0. This is false value for IF st.. and hence else part is executed. 18. ans: (c) reason: t1 is an array. So you need to specify the subscript value while you assign any element to it. char *t1; t1="craft" is correct since *t1 is a pointer and it points to the starting addr.. of the craft. 19. ans: (b). unsolved 20. ans: (b) 21. ans: (a) reason: Its a static array. 22. ans: (b)
  • 4. unsolved 23. ans : (a) 24. ans: (d) 25. ans: (c) reason: c+ +100 is not valid as c=c+100 26. ans: (d) 27. ans: (a) 28. ans: (b) 29. ans: (a) 30. ans:(c) 31. ans: (d) 32. ans: (e) reason: incompatiable type conversions 33. ans: (c) reason: odd no.. AND with 1 gives TRUE value always.
  • 5. 34. ans: (b) reason: if we mention the string as two dimentional(for more than one dim) array with in printf statement,then we should give '&'symbol 35. ans: (b) reason: res=0+1/5; res=1/5+1/4; res=1/5+1/4+1/3; .... res=1/5+1/4+1/3+1/2+1/1; At last time res=1/5+1/4+1/3+1/2+1/1+1/0; ^ | zero divide occur 36. ans: (b) reason: '%c' mainly used for print one charactor We can't specify formate output within '%c' 37. ans: (b) reason: can not modify constant value . It is a fixed value for entire program. 38. ans: (b) reason: 'argc' holds number of arguments. argc consist always value 1 becase file name is one of the input . therefore 1<1 gives false whereas 1==1 gives true.
  • 6. 39. ans: (a) reason: % followed by non-format specifier is printed as such with % symbol 40. ans : (b) reason: if no format specifier is given immediately after the first appearance of % then the characters after the % are printed as such 41. ans: (d) reason: the scanf must have &x,&y for %d format specifiers. 42. ans: (a) reason: In if statement, x=6 is assigned and not checked. 43. ans: (d) reason: self 44. ans: (a) reason: odometer principle, since a is unsigned it is always +ve 45. ans: (a) reason: self 46. ans: (e)
  • 7. reason: unsolved 47. ans: (c) reason: x will contain the garbage value hence default 48. ans: (b) reason: x will contain the garbage value hence default 49. ans: (b) reason: self 50. ans: (b) reason: self 51. ans: (b) reason: recursive function 52. ans: (d) reason: t is a pointer and memory allocation is not needed for that. 53. ans: (a) reason: Each 0 bit in the operand is set to 1, and each 1 bit in the operand is set to 0 if we use ~ 54. ans: (c)
  • 8. reason: int x:8 will get only first 8 bits assigned to it ie., 1 byte of size int x:9 will get only first 9 bits assigned to it ie., 2 byte of size 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 x : 8 a a a a a a a a n n n n n n n n x : 9 a a a a a a a a a n n n n n n n --------------- ---------------------- 1 byte 1 byte 55. ans: (e) reason: 56. ans: (b) reason: self 57. ans: (d) reason: self 58. ans: (a) reason: can't understand 59. ans: (b) reason: self 60. ans: (c) reason: 61.
  • 9. ans: (1) reason: self 62. ans: (b) 63. ans: (c) 64. ans: (a) 65. ans:(c) 66. ans: (f) 67. ans: (b) reason : if you give int main() it goes to infinite loop. 68. ans: (d) 69. ans: (b) 70. ans: (b) 71. ans: (c) 72. ans: (e) 73. ans: (b)
  • 10. reason: if name is given the output is hai 74. ans: (a) 75. ans: (b) 76. ans: (a) 77. ans: (c) 78. ans: (c) 79. ans: (a) 80. ans: (a) 81. 82. ans: (d) reason : pointers cannot be added 83. ans: (d) 84. ans: (b) reason: stack concept
  • 11. 85. ans: (b) 86. ans: (a) 87. ans: (c) 88. ans: (c) 89. ans: (a) 90. ans: (a) 91. 92. 93. ans:(c) 94. ans: (d) reason: message[] is correct 95. ans: (c) reason: static is not allowed in main(..). If removed, junk value. 96. ans: (a) reason: self
  • 12. 97. ans: (b) reason: 98. ans: (a) 99. ans: (b) reason: 100. ans: (c) reason: *_ is an allowed variable