SlideShare a Scribd company logo
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
 
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
 
Java questions1
Java questions1Java questions1
Java questions1yash4884
 
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
 
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
 

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

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

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationDelapenabediema
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdfCarlosHernanMontoyab2
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxRaedMohamed3
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxJisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxricssacare
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativePeter Windle
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsparmarsneha2
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPCeline George
 

Recently uploaded (20)

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

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