[go: up one dir, main page]

0% found this document useful (0 votes)
41 views5 pages

C C++ MCQ

Uploaded by

dhana lalitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views5 pages

C C++ MCQ

Uploaded by

dhana lalitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

C language has been developed by


A) Martin Richards B) Bijarne Stroustrup C) Dennis Ritche D) Ken Thompson
2. int a[ ] ={5,6,7,8,9} What is the value of a[3]?
A) 9 B) 8 C) 7 D) 6
3. C can be used on
A) Only MS-Dos operating System B) Only Linux operating system
C) Only Windows operating system D) All of the above
4. Float a[15], what is the size of array?
A) 17 B) 14 C) 15 D) 16
5. C programs are converted into machine language with the help of
A) An Editor B) A complier C) An operating system D) None of the above
6. Array is
A) Primary data type B) Pointer data type C) Heterogeneous data type
D) Homogenous data type
7. Which of the following is allowed in a C Arithmetic Instruction?
A) [ ] B) { } C) ( ) D) None of the above
8. To accept 100 different values into the array we require
A) Loop B) If condition C) Function D) Structure
9. If a is an integer variable, a=7/3; will return a value
A) 2.5 B) 3 C) 0 D) 2
10. Pointer holds
A) Value of variable B) Address of variable C) Value and address of variable
D) Always null
1. Which of the following is/ are the part of operating
system?
A) Kernel services B) Library services C) Application level services D) All of the above
2. The system of …………… generally ran one job at a time. These were called single stream batch
processing.
A) 40’s B) 50’s C) 60’s D) 70’s
3. In …………. generation of operating system, operating system designers develop the concept
of multi-programming in which several jobs are in main memory at once.
A) First B) Second C) Third D) Fourth
4. State True or False.
i) In spooling high speed
device like a disk is interposed between running program and low-speed device in Input/output.
ii) By using spooling for example instead of writing directly to a printer, outputs are written to the
disk.
A) i-True, ii-False B) i-True, ii-True C) i-False, ii-True D) i-False, ii-False
5. Which of the following
is/are the functions of operating system?
i) Sharing hardware among users. ii) Allowing users to share data among themselves.
iii) Recovering from errors. iv) Preventing users from interfering with one another.
v) Scheduling resources among users.
A) i, ii, iii and iv only B) ii, iii, iv and v only C) i, iii, iv and v only D) All i, ii, iii, iv and v
6. ……………… executes must frequently and makes the fine grained decision of which process
to execute the next.
A) Long-term scheduling B) Medium-term scheduling
C) Short-term scheduling D) None of the above
7. With ……………. a page is brought into main memory only when the reference is made to a
location on that page.
A) demand paging B) main paging C) prepaging D) postpaging
8.………………….. provides a larger sized of virtual memory but require virtual memory which
provides multidimensional memory.
A) Paging method B) Segmentation method C) Paging and segmentation method
D) None of these
9. …………… is a large kernel containing virtually the complete operating system, including,
scheduling, file system, device drivers and memory management.
A) Multilithic kernel B) Monolithic kernel C) Micro kernel D) Macro kernel
10. …………… is a large operating system core provides a wide range of services.
A) Multilithic kernel B) Monolithic kernel C) Micro kernel D) Macro kernel
1
C++ Aptitude Questions with Answers:
1. Which of the following statements is correct?
A. Pointer to derived class cannot be created.
B. Derived class pointer cannot point to base class.
C. Base class pointer cannot point to derived class.
D. Pointer to base class cannot be created.
2. Which of the following concept of oops allows compiler to insert arguments in a function call if
it is not specified?
A. Default arguments B. Call by reference C. Call by value D. Call by pointer
3. How many types of polymorphisms are supported by C++?
A. 3 B. 2 C. 1 D. 4
4. Which of the following correctly describes overloading of functions?
A. Ad-hoc polymorphism B. Transient polymorphism C. Virtual polymorphism
D. Pseudo polymorphism
5. How “Late binding” is implemented in C++?
A. Using C++ tables B. Using Virtual tables C. Using Indexed virtual tables
D. Using polymorphic tables
6. What happens when we try to compile the class definition in following code snippet?
class Birds {};
class Peacock : protected Birds {};
A. It will not compile because a class cannot be protectedly inherited from other class.
B. It will not compile because class body of Eagle is not defined.
C. It will not compile because class body of Birds is not defined.
D. It will compile successfully.
7. Which of the following also known as an instance of a class?
A. Friend Functions B. Member Variables C. Member Functions D. Object
8. What does the class definitions in following code represent?
class Bike
{
Engine objEng;
};
class Engine
{
float CC;
};
A. kind of relationship B. Inheritance C. has a relationship D. Both A and C
9. Which of the following means “The use of an object of one class in definition of another class”?
A. Encapsulation B. Abstraction C. Composition D. Inheritance
10. Which of the following can be overloaded?
A. Object B. Operators C. Functions D. Both B and C
11. Which of the following function prototype is perfectly acceptable?
A. int Function(int Tmp = Show()); B. float = Show(int, float) Function(Tmp);
C. float Function(int Tmp = Show(int, float)); D. Both A and C.
12. Which of the following function declaration is/are incorrect?
A. int Sum(int a = 0, int b, int c = 3); B. int Sum(int a = 5, int b);
C. int Sum(int a, int b = 2, int c = 3); D. All are correct.
E. Both A and B are incorrect.
13. Which of the following statement is correct?
A. The default value for an argument cannot be function call.
B. C++ does not allow the redefinition of a default parameter.
C. Both A and B.
D. C++ allows the redefinition of a default parameter
14. Which of the following function / types of function cannot have default parameters?
A. Member function of class B. Member function of structure
C. main() D. Both B and C
15. What happens when a class with parameterized constructors and having no default constructor is
used in a program and we create an object that needs a zero-argument constructor?
A. Runtime error. B. Preprocessing error. C. Compile-time error. D. Runtime exception.
16. Copy constructor must receive its arguments by __________ .
A. only pass-by-reference B. only pass-by-value C. either pass-by-value or pass-by-reference
D. only pass by address
17. Which of the following gets called when an object goes out of scope?
A. constructor B. virtual function C. main D. destructor
18. Which of the following are NOT provided by the compiler by default?
A. Zero-argument Constructor B. Copy Destructor C. Copy Constructor D. Destructor
19. If the programmer does not explicitly provide a destructor, then which of the following creates an
empty destructor?
A. Preprocessor B. main() function C. Linker D. Compiler
20. Which of the following implicitly creates a default constructor when the programmer does not
explicitly define at least one constructor for a class?
A. Preprocessor B. Compiler C. Loader D. Linker
21. Which of the following never requires any arguments?
A. Default constructor B. Friend function C. Member function D. const function
22. Which of the following statements are correct?
A. Destructor is always called explicitly.
B. Constructor is called either implicitly or explicitly, whereas destructor is always called
implicitly.
C. Constructor is always called explicitly.
D. Constructor and destructor functions are not called at all as they are always inline.
Answer: Option B
23. To ensure that every object in the array receives a destructor call, always delete memory
allocated as an array with operator __________ .
A. delete[]
B. delete
C. destructor
D. kill[]
E. free[]
Answer: Option A
24. What is output ?
int main(){
int i=10;
static int x=i;
if(x==i)
printf(“Equal”);
else if(x>i)
printf(“Greater than”);
else
printf(“Less than”);
return 0;
}
A. Equal
B. Compiler error
C. Less than
D. Greater than
Answer: Option B
25. What will be output if you will compile and execute the following c code?
#include
int main(){
int a=1,2;
int b=(1,2);
printf(“%d %d”,a,b);
return 0;
}
A. 1,1
B. 2,2
C. 2,1
D. 1,2
Answer: Option D
Q1: What is C++?
Ans: C++ is a general purpose object oriented programming language invented in the early 1980 by
bajarne stroutrup.
Q2: What is class?
Ans: A class can be declared as a collection of data members along with members function which
allows association of data and functions into a single unit called encapsulation.
C++ Language
Q3: What are the different features of c++?
Ans: Following are the different features of the Classes in C++,
 Operators and function overloading
 Free storage management
 Constant types
 References
 Inline function
 Virtual function
 Templates
 Exception handling
Q4: Explain constructor?
Ans: Constructors is a member function having the same name as that of its class and is executed
automatically when the class is instantiated(object is created).
Q5: What is a function?
Ans: A function is a block of code which executes the statements when we call it.
It consists of three entities:
1) the function name.this is simply a unique identifier.
2) The function parameters.this is a set of zero or more typed identifier.
3) The function return type this specifies the type of value function returns.
Q6: Explain Inline function?
Ans: Inline function are those function whose function body is inserted in place of the function call.
Q7: What is function overloading?
Ans: function polymorphism for function overloading is a concept that allows multiple function to
share the same name with different arguments type assigning one or more function function body to the
same name is known as function overloading.

ttp://www.treeknox.com/technical-questions/languages/C++/

You might also like