FREE COMPUTER PROGRAMMING MCQs by General knowledge Solutions
FREE COMPUTER PROGRAMMING MCQs by General knowledge Solutions
1. How do we declare an ‘interface’ class?
a. By making all
the methods pure virtual in a class
b. By making all the methods abstract using
the keyword ‘abstract’ in a class
c. By declaring the class as interface with
the keyword ‘interface’
d. It is not possible to create interface class in C++
2. How do we declare an abstract class?
a. By providing at least one pure
virtual method (function signature followed by ==0;) in a class
b. By declaring
at least one method abstract using the keyword ‘abstract’ in a class
c. By
declaring the class abstract with the keyword ‘abstract’
d. It is not possible
to create abstract classes in C++
3. Which of the following is not an
advantage of secondary memory
a. It is cost-effective
b. It has large storage
capacity
c. It has highest speed
d. It is easily portable
4. What happens when
a pointer is deleted twice?
a. It can abort the program
b. It can cause a
failure
c. It can cause an error
d. It can cause a trap
5. Which of the
following language feature is not an access specifier in C++?
a. public
b.
private
c. C protected
d. internal
6. Expression C=i++ causes
a. Value of i
assigned to C and then i incremented by 1
b. i to be incremented by 1 and then
value of i assigned to C
c. Value of i assigned to C
d. i to be incremented by
1
7. The statement i++; is equivalent to
a. i = i + i;
b. i = i + 1;
c. i = i
- 1;
d. i --;
8. In C language, a hexadecimal number is represented by writing
a. x
b. xo
c. ox
d. h
9. Which of the following library function below by
default aborts the program?
a. Terminate()
b. end()
c. Abort()
d. exit()
10. If
a member needs to have unique value for all the objects of that same class,
declare the member as
a. Global variable outside class
b. Local variable inside
constructor
c. Static variable inside class
d. Dynamic variable inside class
11. Value of ix+j, if i,j are integer type and ix long type would be
a. integer
b. float
c. long integer
d. double percision
12. Which of the following below
can perform conversions between pointers to related classes?
a. A. cast_static
b. B. dynamic_cast c.
c. static_cast
d. D. cast_dynamic
13. How do we define a
constructor?
a. a. x~() {}
b. B. X() {}~
c. C. X() ~{}
d. D. ~X() {}
13.
Vtables
a. creates a static table per class
b. creates a static table per
object
c. creates a dynamic table per class
d. creates a dynamic table per
object
14. When class B is inherited from class A, what is the order in which
the constructers of those classes are called
a. Class A first Class B next
b.
Class B first Class A next
c. Class B's only as it is the child class
d. Class
A's only as it is the parent class
15. Which of the following is the most
general exception handler that catches exception of any type? a.
catch(std::exception)
b. catch(std::any_exception)
c. catch(…)
d. catch()
16.
Which of the following is the most general exception handler that catches exception
of ‘any type’?
a. catch(std::exception)
b. catch(std::any_exception)
c.
catch(…)
d. catch()
17. In a group of nested loops, which loop is executed the
most number of times?
a. the outermost loop
b. the innermost loop
c. all loops
are executed the same number of times
d. cannot be determined without knowing
the size of the loops
18. What is the Difference between struct and class in
terms of Access Modifier?
a. By default all the struct members are private
while by default class members are public.
b. By default all the struct members
are protected while by default class members are private.
c. By default all the
struct members are public while by default class members are private.
d. By
default all the struct members are public while by default class members are
protected.
19. Inline functions are invoked at the time of
a. Run time
b.
Compile time
c. Depends on how it is invoked
d. Both b and c above
20. What is
shallow copy?
a. A shallow copy creates a copy of the dynamically allocated
objects too.
b. A shallow copy just copies the values of the data as they are.
c. A shallow copy creates a copy of the statically allocated objects too
d.
Both b and c above
21. What is deep copy?
a. A deep copy creates a copy of the
dynamically allocated objects too.
b. A deep copy just copies the values of the
data as they are.
c. A deep copy creates a copy of the statically allocated
objects too
d. Both b and c above
22. Which of the following below is /are a valid iterator
type?
a. Input Iterator
b. Backward Iterator
c. Forward Iterator
d. Both a and
c above
23. What defines a general set of operations that will be applied to
various types of data?
a. Template class
b. Function template
c. Class template
d. Both a and c above
24. Under which of the following circumstances,
synchronization takes place?
a. When the file is closed
b. When the buffer is
empty
c. Explicitly, with manipulators
d. both a and c
25. Which of the
following functions below can be used Allocate space for array in memory?
a.
calloc()
b. malloc()
c. Realloc()
d. both a and b
26. Statement scanf(“%d”,80);
a. Assign an integer to variable i
b. Give an error message
c. Print the value
of i
d. Assign an float to variable i
27. STL is based on which of the
following programming paradigms?
a. Structured Programming
b. Object Oriented
Programming (OOP)
c. Functional Programming
d. Aspect Oriented Programming
(AOP)
28. STL is based on which of the following programmingparadigms?
a.
Structured Programming
b. Object Oriented Programming (OOP)
c. Functional Programming
d. Aspect Oriented Programming (AOP)
29. If there is more than one statement in
the block of a for loop, which of the following must be placed at the beginning
and the ending of the loop block?
a. parentheses ( )
b. braces { }
c. brackets
[ ].
d. arrows < >
30. Which of the following members do get inherited
but become private members in child class
a. Public
b. Private
c. Protected
d.
All the above
31. Which looping process is best used when the number of
iterations is known?
a. for
b. while
c. do-while
d. all looping processes
require that the iterations be known
32. In a C language ‘3’ represents
a. A
digit
b. An integer
c. A character
d. A word
No comments