OOP MCQs Unit I - OOP Multiple Choice Questions PDF

Title OOP MCQs Unit I - OOP Multiple Choice Questions
Course Object oriented programming
Institution Savitribai Phule Pune University
Pages 129
File Size 2.4 MB
File Type PDF
Total Downloads 7
Total Views 130

Summary

OOP Multiple Choice Questions...


Description

Id Question A B C D Answer Marks Unit

1 Every class has at least one constructor function, even when none is declared. TRUE FALSE

Id Question A B C D Answer Marks Unit

2 Can constructors be overloaded? TRUE FALSE

Id Question A B

3 What is the difference between struct and class in terms of Access Modifier? By default all the struct members are private while by default class members are public. By default all the struct members are protected while by default class members are private. By default all the struct members are public while by default class members are private. By default all the struct members are public while by default class members are protected. C 1 I

C D Answer Marks Unit

Id Question A B C D Answer

A 1 I

A 1 I

4 An abstract class can be instantiated. TRUE FALSE

B

Marks Unit

1 I

Id Question A B C D Answer Marks Unit

5 The default access level assigned to members of a class is ______ Private Public Protected Needs to be assigned A 1 I

Id Question A B C D Answer Marks Unit

6 There is nothing like a virtual constructor of a class. TRUE FALSE

Id Question A B C D Answer Marks Unit

7 Which of the following operators allow defining the member functions of a class outside the class? :: ? :? % A 1 I

Id Question A B C D Answer

8 Which type of class has only one unique value for all the objects of that same class? This Friend Static Both a and b C

B 1 I

Marks Unit

1 I

Id Question A B C D Answer Marks Unit

9 Which one of the following is not a fundamental data type in C++? Float string Int Char B 1 I

Id Question A B C D Answer Marks Unit

10 What is a constructor? A class automatically called whenever a new object of this class is created. A class automatically called whenever a new object of this class is destroyed. A function automatically called whenever a new object of this class is created. A function automatically called whenever a new object of this class is destroyed. C 1 I

Id Question A B C D Answer Marks Unit

11 Under what conditions a destructor destroys an object? Scope of existence has finished Object dynamically assigned and it is released using the operator delete. Program terminated. Both a and b. D 1 I

Id Question

12 If a member needs to have unique value for all the objects of that same class, declare the member as Global variable outside class

A

B C D Answer Marks Unit

Local variable inside constructor Static variable inside class Dynamic variable inside class B 1 I

Id Question

13 If a member needs to have unique value for all the objects of that same class, declare the member as Global variable outside class Local variable inside constructor Static variable inside class Dynamic variable inside class B 1 I

A B C D Answer Marks Unit

A B C D Answer Marks Unit

14 When class B is inherited from class A, what is the order in which the constructers of those classes are called Class A first Class B next Class B first Class A next Class B's only as it is the child class Class A's only as it is the parent class A 1 I

Id

15

Id Question

Question A B C D Answer Marks Unit

Which one of the following is not a valid reserved keyword in C++? Explicit Public Implicit Private C 1 I

Id Question

16 Variables declared in the body of a particular member function are known as data members and can be used in all member functions of the class. TRUE FALSE

A B C D Answer Marks Unit

B 1 I

Id Question A B C D Answer Marks Unit

17 In a class definition, data or functions designated private are accessible to any function in the program. only if you know the password. to member functions of that class. only to public members of the class. C 1 I

Id Question A

18 A member function can always access the data in the object of which it is a member.

B C D Answer Marks Unit

in the class of which it is a member. in any object of the class of which it is a member. in the public part of its class. A 1 I

Id Question A B C D Answer Marks Unit

19 Classes are useful because they can closely model objects in the real world. permit data to be hidden from other classes. bring together all aspects of an entity in one place. Options A, B and C D 1 I

Id Question A B C D Answer Marks Unit

20 For the object for which it was called, a const member function can modify both const and non-const member data. can modify only const member data. can modify only non-const member data. can modify neither const nor non-const member data. D 1 I

Id Question A B C

21 Dividing a program into functions is the key to object-oriented programming. makes the program easier to conceptualize. may reduce the size of the program.

D Answer Marks Unit

Option B and C D 2 I

Id Question A B C D Answer Marks Unit

22 An expression usually evaluates to a numerical value. may be part of a statement. always occurs outside a function. Option A and B D 2 I

Id Question A B C D Answer Marks Unit

23 A variable of type char can hold the value 301. TRUE FALSE

Id Question

24 In an assignment statement, the value on the left of the equal sign is always equal to the value on the right. TRUE FALSE

A B

B 1 I

C D Answer Marks Unit

Id Question A B C D Answer Marks Unit

B 1 I

25 It’s perfectly all right to use variables of different data types in the same arithmetic expression. TRUE FALSE

A 1 I

Id Question A B C D Answer Marks Unit

26 A function’s single most important role is to give a name to a block of code. reduce program size. accept arguments and provide a return value. help organize a program into conceptual units. D 1 I

Id Question

27 A function argument is

A B C D Answer Marks Unit

a variable in the function that receives a value from the calling program. a way that functions resist accepting the calling program’s values. a value sent to the function by the calling program. a value returned by the function to the calling program. C 1 I

Id Question

28 When arguments are passed by value, the function works with the original arguments in the calling program. TRUE FALSE

A B C D Answer Marks Unit

B 1 I

Id Question A B C D Answer Marks Unit

29 Which of the following can legitimately be passed to a function? A constant A variable A structure All of the above D 1 I

Id Question A B C D Answer Marks Unit

30 How many values can be returned from a function? 0 1 2 3 B 1 I

Id Question A B C D Answer Marks Unit

31 When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable. TRUE FALSE

A 1 I

Id Question A B C D Answer Marks Unit

32 When an argument is passed by reference a variable is created in the function to hold the argument’s value. the function cannot access the argument’s value. a temporary variable is created in the calling program to hold the argument’s value. the function accesses the argument’s original value in the calling program. D 1 I

Id Question A B C D Answer Marks Unit

33 Overloaded functions are a group of functions with the same name. all have the same number and types of arguments. make life simpler for programmers. A and C D 2 I

Id Question A B C D Answer Marks Unit

34 A default argument has a value that may be supplied by the calling program. may be supplied by the function. must have a constant value. A and B 1 1 I

Id Question A B C D Answer Marks Unit

35 A static local variable is used to make a variable visible to several functions. make a variable visible to only one function. retain a value when a function is not executing. B and C D 2 I

Id Question A B C D Answer Marks Unit

36 In C++ there can be an array of four dimensions. TRUE FALSE

A 1 I

Id Question A B C D Answer Marks Unit

37 When an array name is passed to a function, the function accesses exactly the same array as the calling program. refers to the array using a different name than that used by the calling program. refers to the array using the same name as that used by the calling program. A and B D 1 I

Id Question A B C D Answer Marks Unit

38 The compiler will complain if you try to access array element 14 in a 10-element array. TRUE FALSE

B 1 I

Id Question A B C D Answer Marks Unit

39 The extraction operator (>>) stops reading a string when it encounters a space. TRUE FALSE

A 1 I

Id Question A B C D Answer Marks Unit

40 You can read input that consists of multiple lines of text using the normal cout...


Similar Free PDFs