CSE

Welcome To Computer Science & Engineering. This Site Contains Complete Information of Computer Engineering, Computer Science & Engineering, Computer Information System, Software Engineering, Computer Science Course Schedule, Course Tutorial, Suggestions, University Tuition Fees, Study Guideline & More.

Computer Science and Engineering Subject C++ Question Sample



MCQ Questions Of C++ With Answers
1. When a function is defined inside a class, this function is called ………….
A) Inside function
B) Class function
C) Inline function
D) Interior function

2. Which of the following cannot be passed to a function?
A) Reference variable
B) Arrays
C) Class objects
D) Header files

3. State true of false.
i) We cannot make the function inline by defining a function outside the class.
ii) A member function can be called by using its name inside another member function of the same class, this is known as nesting of member function.
A) True, True
B) True, False
C) False, True
D) False, False

4. Which of the following operators could be overloaded?
A) Size of
B) +
C) +=
D) ::

5. Which of the following is true about the static member variable in C++.
i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted.
ii) It is visible only within the class, but its lifetime is the entire program.
A) i-True, ii-True
B) ii-False, ii-True
C) i-True, ii-False
D) i-False, iii-False

6. Which of the following keywords are used to control access to a class member?
A) default
B) break
C) protected
D) goto

7. What will be the values of x, m and n after execution of the following statements?
Int x, m, n;
 m=10;
n=15;
                x= ++m + n++;

A) x=25, m=10, n=15
B) x=27, m=10, n=15
C) x=26, m=11, n=16
D) x=27, m=11, n=16

8. The major goal of inheritance in C++ is
A) To facilitate the conversion of data types
B) To help modular programming
C) To facilitate the re usability of code
D) To extend the capabilities of a class

9. A variable is defined within a block in a body of a function. Which of the following are true?
A) It is visible throughout the function.
B) It is visible from the point of definition to the end of the program.
C) It is visible from the point of definition to the end of the block.
D) It is visible throughout the block.

10. The friend functions are used in situations where
A) We want to exchange data between classes
B) We want to have access to unrelated classes
C) Dynamic binding is required
D) We want to create versatile overloaded operators.

Answers

1. C) Inline function
2.   D) Header files
3.   C) False, True
4.   B) +
5.   B) ii-False, ii-True
6.   C) protected
7.   C) x=26, m=11, n=16
8.   C) To facilitate the reusability of code
9.   D) It is visible throughout the block.
10.  A) We want to exchange … classes

 C++ Set-4

1. In C++ ..................... operator is used for Dynamic memory allocation.
A) Scope resolution
B) Conditional
C) New
D) Membership access

2. Operators such as ...................... cannot be overloaded.
A) +
B) ++
C) : :
D) = =

3. The ...................... objects have values that can be tested for various error conditions.
A) osstream
B) ofstream
C) stream
D) ifstream

4. Which function return the current position of the get or put pointer in bytes.
A) tellg( )
B) tellp( )
C) tell( )
D) Both A and B

5. The first index number in an array starts with ............................ and the index number of an array of size n will be ............
A) 0, n-1
B) 1, n-1
C) 0, n
D) 1, n

6. To overload an operator ..................... keyword must be used along with the operator to be overloaded.
A) Over
B) Overload
C) Void
D) Operator

7. What is the output of the program
#include<iostream.h>

void main()
{
     int n=1;
     cout<<endl<<"The numbers are;"<<endl;
     do
           {

cout<<n<<"\t";
n++;
           } while (n<=100);
     cout<<endl;
 }

A) Print natural numbers 0 to 99
B) Print natural numbers 1 to 99
C) Print natural numbers 0 to 100
D) Print natural numbers 1 to 100

8. Everything defined at the program scope level (ie. outside functions and classes) is said to be ...............
A) local scope
B) regional scope
C) global scope
D) static scope

9. Because the lifetime of a local variable is limited and determined automatically, these variables are also called ............................
A) automator
B) automatic
C) dynamic
D) static

10. ................ allows that a section of a program is compiled only if the defined constant that is specified as the parameter has been defined, independently of its value.
A) #ifdef
B) #if
C) #define
D) #ifd


Answers

1.       C) New
2. C) : :
3. D) ifstream
4. B) tellp( )
5. A) 0, n-1
6. D) Operator
7. D) Print natural numbers 1 to 100
8. C) global scope
9. B) automatic
10. A) #ifdef

C++ Set-5

1. There is a unique function in C++ program by where all C++ programs start their execution with ........

A) start()


B) begin()

C) main ()


D) output()



2. Which of the following is not a jump statement in C++?

A) break

B) Goto

C) Exit

D) Switch 



3. The memory address of the first element of an array is called ...................

A) floor address

B) foundation address

C) first address

D) base address



4. C++ exception handling 
mechanism mainly uses how many keywords?

A) Four

B) Three

C) Two 

D) None of the above



5. When an exception is thrown, it needs to be .....................

A) Executed

B) Handled appropriately

C) Resolved 

D) None of the above



6. After defining the function template
, the next step to call it in another function such as .........

A) int()

B) secondary()

C) template()

D) main() 



7. A file stream refers to the flow of data between a ...............

A) Program
and object

B) Program and stream

C) Program and file

D) None of the above




8. .................. are one of the attributes of C++ that support run-time polymorphism.

A) Pointers

B) Derived classes

C) Virtual function


D) Heap tree




9. which of the following header file
does not exist?

A) iostream

B) string

C) sstring

D) sstream




10. To increase the value of c by one, which of the following is wrong?

A) c++;

B) c=c+1;

C) c+1=>c;

D) c+=1;






Answers:



1. There is a unique function in C++ program by where all C++ programs start their execution with ........

C) main()

2. Which of the following is not a jump statement in C++?

D) Switch 

3. The memory address of the first element of an array is called ...................

D) base address

4. C++ exception handling mechanism mainly uses how many keywords?

B) Three

5. When an exception is thrown, it needs to be .....................

B) Handled appropriately

6. After defining the function template, the next step to call it in another function such as .........

D) main() 

7. A file stream refers to the flow of data between a ...............

C) Program and file

8. .................. are one of the attributes of C++ that support run-time polymorphism.

C) Virtual functions

9. which of the following header file does not exist?

C) sstring

10. To increase the value of c by one, which of the following is wrong?

C) c+1=>c;

No comments:

Post a Comment

Watch Thousands New Movie

Search This Blog

Video Bar

Loading...

Google+ Followers