SlideShare a Scribd company logo
1 of 30
Cโ€ฆ Programming Questions
Useful for all Companies Interviews,
UGC-NET, GATE EXAM
PART- 3
51. What is the output of this C code?
#include <stdio.h>
int main()
{
register static int i = 10;
i = 11;
printf("%dn", i);
}
a) 10
b) Compile time error
c) Undefined behaviour
d) 11
Answer: B
52. The C- preprocessors are specified with _________symbol.
a) #
b) $
c) โ€ โ€
d) None of the mentioned
53. The #include directive
a) Tells the pre-processor to grab the text of a file and place it directly into the
current file
b) Statements are typically placed at the top of a program
c) both a & b
d) None of a & b
Answer: A
Answer: C
54. The preprocessor provides the ability for _______________.
a) The inclusion of header files
b) The inclusion of macro expansions
c) Conditional compilation and line control.
d) All of the mentioned
55. If #include is used with file name in angular brackets
a) The file is searched for in the standard compiler include paths
b) The search path is expanded to include the current source directory
c) Both a & b
d) None of the mentioned
Answer: D
Answer: A
56. Which of the following data types are accepted while declaring bit-fields?
a) char
b) float
c) double
d) None of the mentioned
57. Which of the following reduces the size of a structure?
a) union
b) bit-fields
c) malloc
d) None of the mentioned
Answer: A
Answer: B
58. In the declaration of bit-fields,
struct-declarator:
declarator
type-specifier declarator opt : constant-expression
The constant-expression specifies
a) The width of the field in bits.
b) Nothing
c) The width of the field in bytes.
d) Error
Answer: A
59. In the declaration of bit-fields,
struct-declarator:
declarator
type-specifier declarator opt : constant-expression
The constant-expression must be
a) Any type
b) Nothing
c) Integer value
d) Nonnegative integer value
Answer:D
60. Which of the following is not allowed?
a) Arrays of bit fields
b) Pointers to bit fields
c) Functions returning bit fields
d) None of the mentioned
61. Bit fields can only be declared as part of a structure.
a) false
b) true
c) Nothing
d) Varies
Answer: D
Answer: B
62. The following declarations in order are
short a : 17;
int long y : 33;
a) Legal, legal
b) Legal, illegal
c) Illegal, illegal
d) Illegal, legal
Answer: C
63. Which of the following return-type cannot be used for a function in C?
a) char *
b) struct
c) void
d) None of the mentioned
64. Presence of code like โ€œs.t.b = 10โ€ indicate.
a) Syntax Error
b) structure
c) double data type
d) An ordinary variable name
Answer: D
Answer: B
65. Which of the following is not possible under any scenario?
a) s1 = &s2;
b) s1 = s2;
c) (*s1).number = 10;
d) None of the mentioned
66. Which of the following operation is illegal in structures?
a) Typecasting of structure
b) Pointer to a variable of same structure
c) Dynamic allocation of memory for structure
d) All of the mentioned
Answer: D
Answer: A
67. Which of the following are themselves a collection of different data types?
a) string
b) structures
c) char
d) All of the mentioned
68. User-defined data type can be derived by___________.
a) struct
b) enum
c) typedef
d) All of the mentioned
Answer: B
Answer: D
69. Which operator connects the structure name to its member name?
a) โ€“
b) <-
c) .
d) Both (b) and (c)
70. Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) None of the mentioned
Answer: C
Answer: B
71. Size of a union is determined by size of the.
a) First member in the union
b) Last member in the union
c) Biggest member in the union
d) Sum of the sizes of all members
72. Members of a union are accessed as________________.
a) union-name.member
b) union-pointer->member
c) Both a & b
d) None of the mentioned
Answer: C
Answer: C
73. The number of digits present after decimal in float is________.
a. 1
b. 3
c. 6
d. 16
74. Which among the following is never possible as an output for float?
a. 3.666666
b. 3.666
c. 3
d. None of the mentioned
Answer: D
Answer: C
75. In a 32-bit compiler, which 2 types have same size?
a. char and short
b. short and int
c. int and float
d. float and double
76. What is the size of float in a 32-bit compiler?
a. 1
b. 2
c. 4
d. 8
Answer: C
Answer: C
77. Loss in precision occurs for typecasting from____________.
a. char to short
b. float to double
c. long to float
d. float to int
78. Select the odd one out with respect to type?
a. char
b. int
c. long
d. float
Answer: D
Answer: D
79. The size is decided by:
a. char
b. int
c. float
d. Both (b) and (c)
80. %f access specifier is used for
a. Strings
b. Integral types
c. Floating type
d. All of the mentioned
Answer: D
Answer: C
81. What is the sizeof(char) in a 32-bit C compiler?
a. 1 bit
b. 2 bits
c. 1 Byte
d. 2 Bytes
82. What is the output of this C code?
#include <stdio.h>
printf("%d", sizeof('a'));
a. 1
b. 2
c. 4
d. None of the mentioned
Answer: C
Answer: C
83. Size of an array can be evaluated by:
(Assuming array declaration int a[10];)
a. sizeof(a);
b. sizeof(*a);
c. sizeof(a[10]);
d. 10 * sizeof(a);
Answer: A
84. Which of the following is not an operator in C?
a. ,
b. sizeof()
c. ~
d. None of the mentioned
85. Which among the following has the highest precedence?
a. &
b. <<
c. sizeof()
d. &&
Answer: D
Answer: C
86. The sizeof(void) in a 32-bit C is_____.
a. 0
b. 1
c. 2
d. 4
87. What type of value does sizeof return?
a. char
b. short
c. unsigned int
d. long
Answer: B
Answer: C
88. Which among the following is never possible in C when members are
different in a structure and union?
//Let P be a structure
//Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is less than sizeof(Q)
c. sizeof(P) is equal to sizeof(Q)
d. None of the mentioned
Answer: D
89. Which among the following is never possible in C when members in a
structure are same as that in a union?
//Let P be a structure
//Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is equal to sizeof(Q)
c. sizeof(P) is less than to sizeof(Q)
d. None of the mentioned
Answer: C
90. Which among the following is right?
a. sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *)
b. sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *)
c. sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)
d. The order Depends on the compiler
Answer: C
91. Which of the following cannot be used inside sizeof?
a. pointers
b. functions
c. macro definition
d. None of the mentioned
Answer:d
92. What is the output of this C code?
#include <stdio.h>
printf("%.0f", 2.89);
a. 2.890000
b. 2.89
c. 2
d. 3
Answer: D
93. What is the output of this C code?
#include <stdio.h>
int main()
{
float a = 2.455555555555;
printf("%f", a);
}
a. 2.455555
b. 2.455556
c. 2.456
d. 2.46
Answer: A
94. Which of the following % operation is invalid?
a. 2 % 4;
b. 2 % 4l;
c. 2 % 4f;
d. Both (b) and (c)
95. Which data type is suitable for storing a number like?
10.0000000001
a. int
b. float
c. double
d. Both (b) and (c)
Answer: C
Answer: C
96. Modulus for float could be achieved by?
a. a % b
b. modulus(a, b);
c. fmod(a, b);
d. mod(a, b);
97. Predict the data type of the following mathematical operation?
2 * 9 + 3 / 2 . 0
a. int
b. long
c. float
d. double
Answer: C
Answer: D
98. %lf is used to display
a. float
b. long float
c. double
d. All of the mentioned
Answer: C

More Related Content

What's hot

Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSESujata Regoti
ย 
C mcq practice test 4
C mcq practice test 4C mcq practice test 4
C mcq practice test 4Aman Kamboj
ย 
Ramco Sample Paper 2003
Ramco  Sample  Paper 2003Ramco  Sample  Paper 2003
Ramco Sample Paper 2003ncct
ย 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 QuizzesSteven Luo
ย 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqpPrasanth566435
ย 
200 mcq c++(Ankit dubey)
200 mcq c++(Ankit dubey)200 mcq c++(Ankit dubey)
200 mcq c++(Ankit dubey)Ankit Dubey
ย 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomeshpraveensomesh
ย 
Java Questioner for
Java Questioner for Java Questioner for
Java Questioner for Abhay Korat
ย 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011Deepak Singh
ย 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1 UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1 Knowledge Center Computer
ย 
C mcq practice test 1
C mcq practice test 1C mcq practice test 1
C mcq practice test 1Aman Kamboj
ย 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manualAnil Bishnoi
ย 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 solIIUM
ย 
Puzles C#
Puzles C#Puzles C#
Puzles C#lantoli
ย 

What's hot (18)

Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSE
ย 
C mcq practice test 4
C mcq practice test 4C mcq practice test 4
C mcq practice test 4
ย 
Test1
Test1Test1
Test1
ย 
Ramco Sample Paper 2003
Ramco  Sample  Paper 2003Ramco  Sample  Paper 2003
Ramco Sample Paper 2003
ย 
Java Quiz
Java QuizJava Quiz
Java Quiz
ย 
C question bank
C question bankC question bank
C question bank
ย 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 Quizzes
ย 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
ย 
200 mcq c++(Ankit dubey)
200 mcq c++(Ankit dubey)200 mcq c++(Ankit dubey)
200 mcq c++(Ankit dubey)
ย 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
ย 
Java Questioner for
Java Questioner for Java Questioner for
Java Questioner for
ย 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011
ย 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1 UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 1
ย 
C mcq practice test 1
C mcq practice test 1C mcq practice test 1
C mcq practice test 1
ย 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manual
ย 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
ย 
Quiz test JDBC
Quiz test JDBCQuiz test JDBC
Quiz test JDBC
ย 
Puzles C#
Puzles C#Puzles C#
Puzles C#
ย 

Similar to Part - 3 Cpp programming Solved MCQ

this pdf very much useful for embedded c programming students
this pdf very much useful for embedded c programming studentsthis pdf very much useful for embedded c programming students
this pdf very much useful for embedded c programming studentspavan81088
ย 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2Knowledge Center Computer
ย 
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdfLDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdfVedant Gavhane
ย 
C aptitude 1st jan 2012
C aptitude 1st jan 2012C aptitude 1st jan 2012
C aptitude 1st jan 2012Kishor Parkhe
ย 
ExamName___________________________________MULTIPLE CH.docx
ExamName___________________________________MULTIPLE CH.docxExamName___________________________________MULTIPLE CH.docx
ExamName___________________________________MULTIPLE CH.docxgitagrimston
ย 
Exam for c
Exam for cExam for c
Exam for cvijasli25
ย 
Java questions1
Java questions1Java questions1
Java questions1yash4884
ย 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operatorsHINAPARVEENAlXC
ย 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docxrosemarybdodson23141
ย 
Std 10 Chapter 10 Introduction to C Language Important MCQs
Std 10 Chapter 10 Introduction to C Language Important MCQsStd 10 Chapter 10 Introduction to C Language Important MCQs
Std 10 Chapter 10 Introduction to C Language Important MCQsNuzhat Memon
ย 
Gate-Cs 1994
Gate-Cs 1994Gate-Cs 1994
Gate-Cs 1994Ravi Rajput
ย 
Unit 5
Unit 5Unit 5
Unit 5Asif Iqbal
ย 
New microsoft office word document (3)
New microsoft office word document (3)New microsoft office word document (3)
New microsoft office word document (3)Sagar Kuchekar
ย 
C++ questions
C++ questionsC++ questions
C++ questionsanujchouksey
ย 

Similar to Part - 3 Cpp programming Solved MCQ (20)

this pdf very much useful for embedded c programming students
this pdf very much useful for embedded c programming studentsthis pdf very much useful for embedded c programming students
this pdf very much useful for embedded c programming students
ย 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
ย 
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdfLDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
ย 
C aptitude 1st jan 2012
C aptitude 1st jan 2012C aptitude 1st jan 2012
C aptitude 1st jan 2012
ย 
Part - 2 Cpp programming Solved MCQ
Part - 2  Cpp programming Solved MCQ Part - 2  Cpp programming Solved MCQ
Part - 2 Cpp programming Solved MCQ
ย 
C Programming
C ProgrammingC Programming
C Programming
ย 
ExamName___________________________________MULTIPLE CH.docx
ExamName___________________________________MULTIPLE CH.docxExamName___________________________________MULTIPLE CH.docx
ExamName___________________________________MULTIPLE CH.docx
ย 
Exam for c
Exam for cExam for c
Exam for c
ย 
PART - 1 Cpp programming Solved MCQ
PART - 1 Cpp programming Solved MCQPART - 1 Cpp programming Solved MCQ
PART - 1 Cpp programming Solved MCQ
ย 
Java questions1
Java questions1Java questions1
Java questions1
ย 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operators
ย 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
ย 
Soln dc05
Soln dc05Soln dc05
Soln dc05
ย 
Std 10 Chapter 10 Introduction to C Language Important MCQs
Std 10 Chapter 10 Introduction to C Language Important MCQsStd 10 Chapter 10 Introduction to C Language Important MCQs
Std 10 Chapter 10 Introduction to C Language Important MCQs
ย 
Gate-Cs 1994
Gate-Cs 1994Gate-Cs 1994
Gate-Cs 1994
ย 
Unit 5
Unit 5Unit 5
Unit 5
ย 
operators.ppt
operators.pptoperators.ppt
operators.ppt
ย 
New microsoft office word document (3)
New microsoft office word document (3)New microsoft office word document (3)
New microsoft office word document (3)
ย 
C++ questions
C++ questionsC++ questions
C++ questions
ย 
C test
C testC test
C test
ย 

More from Knowledge Center Computer

Specialization and generalization quizz
Specialization and generalization quizzSpecialization and generalization quizz
Specialization and generalization quizzKnowledge Center Computer
ย 
Programming languages java, python, sql and compare between c and python
Programming languages  java, python, sql and compare between c and pythonProgramming languages  java, python, sql and compare between c and python
Programming languages java, python, sql and compare between c and pythonKnowledge Center Computer
ย 
Information assistant exam complete syllabus 2018
Information assistant exam  complete syllabus  2018Information assistant exam  complete syllabus  2018
Information assistant exam complete syllabus 2018Knowledge Center Computer
ย 

More from Knowledge Center Computer (20)

APS PGT Computer Science SylIabus
APS PGT Computer Science SylIabusAPS PGT Computer Science SylIabus
APS PGT Computer Science SylIabus
ย 
Specialization and generalization quizz
Specialization and generalization quizzSpecialization and generalization quizz
Specialization and generalization quizz
ย 
Data structure part 3
Data structure part  3Data structure part  3
Data structure part 3
ย 
Data structure part 4
Data structure part  4Data structure part  4
Data structure part 4
ย 
Data structure part 2
Data structure part  2Data structure part  2
Data structure part 2
ย 
Data structure part 1
Data structure part  1Data structure part  1
Data structure part 1
ย 
Computer architecture PART 2
Computer architecture  PART  2Computer architecture  PART  2
Computer architecture PART 2
ย 
Computer architecture PART 1
Computer architecture  PART 1Computer architecture  PART 1
Computer architecture PART 1
ย 
Course design class 12 ip
Course design class 12 ipCourse design class 12 ip
Course design class 12 ip
ย 
CBSE 12 ip 2018 sample paper
CBSE 12 ip 2018 sample paperCBSE 12 ip 2018 sample paper
CBSE 12 ip 2018 sample paper
ย 
Programming languages java, python, sql and compare between c and python
Programming languages  java, python, sql and compare between c and pythonProgramming languages  java, python, sql and compare between c and python
Programming languages java, python, sql and compare between c and python
ย 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
ย 
E commerce and types
E commerce and typesE commerce and types
E commerce and types
ย 
Android Operating System(OS)
Android Operating System(OS)Android Operating System(OS)
Android Operating System(OS)
ย 
Networking Basic MCQ's TEST
Networking Basic  MCQ's TESTNetworking Basic  MCQ's TEST
Networking Basic MCQ's TEST
ย 
Physics QUIZ
Physics QUIZ Physics QUIZ
Physics QUIZ
ย 
Ms word mcq
Ms word mcqMs word mcq
Ms word mcq
ย 
Ms word mcq
Ms word mcqMs word mcq
Ms word mcq
ย 
Information assistant exam complete syllabus 2018
Information assistant exam  complete syllabus  2018Information assistant exam  complete syllabus  2018
Information assistant exam complete syllabus 2018
ย 
Computer fundamentals in hindi
Computer fundamentals in hindiComputer fundamentals in hindi
Computer fundamentals in hindi
ย 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
ย 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
ย 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
ย 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
ย 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
ย 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
ย 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
ย 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
ย 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
ย 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
ย 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
ย 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
ย 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
ย 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
ย 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
ย 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
ย 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
ย 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
ย 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
ย 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
ย 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
ย 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
ย 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
ย 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
ย 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
ย 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
ย 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ย 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
ย 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
ย 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
ย 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
ย 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
ย 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
ย 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
ย 
Model Call Girl in Bikash Puri Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
Model Call Girl in Bikash Puri  Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”Model Call Girl in Bikash Puri  Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
Model Call Girl in Bikash Puri Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
ย 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
ย 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
ย 

Part - 3 Cpp programming Solved MCQ

  • 1. Cโ€ฆ Programming Questions Useful for all Companies Interviews, UGC-NET, GATE EXAM PART- 3
  • 2. 51. What is the output of this C code? #include <stdio.h> int main() { register static int i = 10; i = 11; printf("%dn", i); } a) 10 b) Compile time error c) Undefined behaviour d) 11 Answer: B
  • 3. 52. The C- preprocessors are specified with _________symbol. a) # b) $ c) โ€ โ€ d) None of the mentioned 53. The #include directive a) Tells the pre-processor to grab the text of a file and place it directly into the current file b) Statements are typically placed at the top of a program c) both a & b d) None of a & b Answer: A Answer: C
  • 4. 54. The preprocessor provides the ability for _______________. a) The inclusion of header files b) The inclusion of macro expansions c) Conditional compilation and line control. d) All of the mentioned 55. If #include is used with file name in angular brackets a) The file is searched for in the standard compiler include paths b) The search path is expanded to include the current source directory c) Both a & b d) None of the mentioned Answer: D Answer: A
  • 5. 56. Which of the following data types are accepted while declaring bit-fields? a) char b) float c) double d) None of the mentioned 57. Which of the following reduces the size of a structure? a) union b) bit-fields c) malloc d) None of the mentioned Answer: A Answer: B
  • 6. 58. In the declaration of bit-fields, struct-declarator: declarator type-specifier declarator opt : constant-expression The constant-expression specifies a) The width of the field in bits. b) Nothing c) The width of the field in bytes. d) Error Answer: A
  • 7. 59. In the declaration of bit-fields, struct-declarator: declarator type-specifier declarator opt : constant-expression The constant-expression must be a) Any type b) Nothing c) Integer value d) Nonnegative integer value Answer:D
  • 8. 60. Which of the following is not allowed? a) Arrays of bit fields b) Pointers to bit fields c) Functions returning bit fields d) None of the mentioned 61. Bit fields can only be declared as part of a structure. a) false b) true c) Nothing d) Varies Answer: D Answer: B
  • 9. 62. The following declarations in order are short a : 17; int long y : 33; a) Legal, legal b) Legal, illegal c) Illegal, illegal d) Illegal, legal Answer: C
  • 10. 63. Which of the following return-type cannot be used for a function in C? a) char * b) struct c) void d) None of the mentioned 64. Presence of code like โ€œs.t.b = 10โ€ indicate. a) Syntax Error b) structure c) double data type d) An ordinary variable name Answer: D Answer: B
  • 11. 65. Which of the following is not possible under any scenario? a) s1 = &s2; b) s1 = s2; c) (*s1).number = 10; d) None of the mentioned 66. Which of the following operation is illegal in structures? a) Typecasting of structure b) Pointer to a variable of same structure c) Dynamic allocation of memory for structure d) All of the mentioned Answer: D Answer: A
  • 12. 67. Which of the following are themselves a collection of different data types? a) string b) structures c) char d) All of the mentioned 68. User-defined data type can be derived by___________. a) struct b) enum c) typedef d) All of the mentioned Answer: B Answer: D
  • 13. 69. Which operator connects the structure name to its member name? a) โ€“ b) <- c) . d) Both (b) and (c) 70. Which of the following cannot be a structure member? a) Another structure b) Function c) Array d) None of the mentioned Answer: C Answer: B
  • 14. 71. Size of a union is determined by size of the. a) First member in the union b) Last member in the union c) Biggest member in the union d) Sum of the sizes of all members 72. Members of a union are accessed as________________. a) union-name.member b) union-pointer->member c) Both a & b d) None of the mentioned Answer: C Answer: C
  • 15. 73. The number of digits present after decimal in float is________. a. 1 b. 3 c. 6 d. 16 74. Which among the following is never possible as an output for float? a. 3.666666 b. 3.666 c. 3 d. None of the mentioned Answer: D Answer: C
  • 16. 75. In a 32-bit compiler, which 2 types have same size? a. char and short b. short and int c. int and float d. float and double 76. What is the size of float in a 32-bit compiler? a. 1 b. 2 c. 4 d. 8 Answer: C Answer: C
  • 17. 77. Loss in precision occurs for typecasting from____________. a. char to short b. float to double c. long to float d. float to int 78. Select the odd one out with respect to type? a. char b. int c. long d. float Answer: D Answer: D
  • 18. 79. The size is decided by: a. char b. int c. float d. Both (b) and (c) 80. %f access specifier is used for a. Strings b. Integral types c. Floating type d. All of the mentioned Answer: D Answer: C
  • 19. 81. What is the sizeof(char) in a 32-bit C compiler? a. 1 bit b. 2 bits c. 1 Byte d. 2 Bytes 82. What is the output of this C code? #include <stdio.h> printf("%d", sizeof('a')); a. 1 b. 2 c. 4 d. None of the mentioned Answer: C Answer: C
  • 20. 83. Size of an array can be evaluated by: (Assuming array declaration int a[10];) a. sizeof(a); b. sizeof(*a); c. sizeof(a[10]); d. 10 * sizeof(a); Answer: A
  • 21. 84. Which of the following is not an operator in C? a. , b. sizeof() c. ~ d. None of the mentioned 85. Which among the following has the highest precedence? a. & b. << c. sizeof() d. && Answer: D Answer: C
  • 22. 86. The sizeof(void) in a 32-bit C is_____. a. 0 b. 1 c. 2 d. 4 87. What type of value does sizeof return? a. char b. short c. unsigned int d. long Answer: B Answer: C
  • 23. 88. Which among the following is never possible in C when members are different in a structure and union? //Let P be a structure //Let Q be a union a. sizeof(P) is greater than sizeof(Q) b. sizeof(P) is less than sizeof(Q) c. sizeof(P) is equal to sizeof(Q) d. None of the mentioned Answer: D
  • 24. 89. Which among the following is never possible in C when members in a structure are same as that in a union? //Let P be a structure //Let Q be a union a. sizeof(P) is greater than sizeof(Q) b. sizeof(P) is equal to sizeof(Q) c. sizeof(P) is less than to sizeof(Q) d. None of the mentioned Answer: C
  • 25. 90. Which among the following is right? a. sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *) b. sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *) c. sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *) d. The order Depends on the compiler Answer: C 91. Which of the following cannot be used inside sizeof? a. pointers b. functions c. macro definition d. None of the mentioned Answer:d
  • 26. 92. What is the output of this C code? #include <stdio.h> printf("%.0f", 2.89); a. 2.890000 b. 2.89 c. 2 d. 3 Answer: D
  • 27. 93. What is the output of this C code? #include <stdio.h> int main() { float a = 2.455555555555; printf("%f", a); } a. 2.455555 b. 2.455556 c. 2.456 d. 2.46 Answer: A
  • 28. 94. Which of the following % operation is invalid? a. 2 % 4; b. 2 % 4l; c. 2 % 4f; d. Both (b) and (c) 95. Which data type is suitable for storing a number like? 10.0000000001 a. int b. float c. double d. Both (b) and (c) Answer: C Answer: C
  • 29. 96. Modulus for float could be achieved by? a. a % b b. modulus(a, b); c. fmod(a, b); d. mod(a, b); 97. Predict the data type of the following mathematical operation? 2 * 9 + 3 / 2 . 0 a. int b. long c. float d. double Answer: C Answer: D
  • 30. 98. %lf is used to display a. float b. long float c. double d. All of the mentioned Answer: C