MCQOPTIONS
Saved Bookmarks
This section includes 37 Mcqs, each offering curated multiple-choice questions to sharpen your C Sharp Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
If 2 classes derive one base class and redefine a function of base class, also overload some operators inside class body. Among these two things of function and operator overloading, where is polymorphism used? |
| A. | Function overloading only |
| B. | Operator overloading only |
| C. | Both of these are using polymorphism |
| D. | Either function overloading or operator overloading because polymorphism can be applied only once in a program |
| Answer» E. | |
| 2. |
Which among the following is not true for polymorphism? |
| A. | It is feature of OOP |
| B. | Ease in readability of program |
| C. | Helps in redefining the same functionality |
| D. | Increases overhead of function definition always |
| Answer» E. | |
| 3. |
Which problem may arise if we use abstract class functions for polymorphism? |
| A. | All classes are converted as abstract class |
| B. | Derived class must be of abstract type |
| C. | All the derived classes must implement the undefined functions |
| D. | Derived classes can’t redefine the function |
| Answer» D. Derived classes can’t redefine the function | |
| 4. |
Polymorphism is possible in C language. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 5. |
Find the output of the following program. |
| A. | Its school education system |
| B. | Its education system |
| C. | Its school education systemIts education system |
| D. | Its education systemIts school education systemView Answer |
| Answer» B. Its education system | |
| 6. |
Which among the following can show polymorphism? |
| A. | Overloading || |
| B. | Overloading += |
| C. | Overloading << |
| D. | Overloading && |
| Answer» D. Overloading && | |
| 7. |
What is output of the following program? |
| A. | Its base classIts derived class |
| B. | Its base class Its derived class |
| C. | Its derived classIts base class |
| D. | Its derived class Its base classView Answer |
| Answer» B. Its base class Its derived class | |
| 8. |
Which among the following can’t be used for polymorphism? |
| A. | Static member functions |
| B. | Member functions overloading |
| C. | Predefined operator overloading |
| D. | Constructor overloading |
| Answer» B. Member functions overloading | |
| 9. |
In case of using abstract class or function overloading, which function is supposed to be called first? |
| A. | Local function |
| B. | Function with highest priority in compiler |
| C. | Global function |
| D. | Function with lowest priority because it might have been halted since long time, because of low priority |
| Answer» C. Global function | |
| 10. |
Which type of function among the following shows polymorphism? |
| A. | Inline function |
| B. | Virtual function |
| C. | Undefined functions |
| D. | Class member functions |
| Answer» C. Undefined functions | |
| 11. |
Which class/set of classes can illustrate polymorphism in the following code? |
| A. | Only class student can show polymorphism |
| B. | Only class student and topper together can show polymorphism |
| C. | All class student, topper and average together can show polymorphism |
| D. | Class failed should also inherit class student for this code to work for polymorphismView Answer |
| Answer» D. Class failed should also inherit class student for this code to work for polymorphismView Answer | |
| 12. |
If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called? |
| A. | Inheritance |
| B. | Overloading |
| C. | Polymorphism |
| D. | Overriding |
| Answer» D. Overriding | |
| 13. |
Which among the following is the language which supports classes but not polymorphism? |
| A. | SmallTalk |
| B. | Java |
| C. | C++ |
| D. | Ada |
| Answer» E. | |
| 14. |
What do you call the languages that support classes but not polymorphism? |
| A. | Class based language |
| B. | Procedure Oriented language |
| C. | Object-based language |
| D. | If classes are supported, polymorphism will always be supported |
| Answer» D. If classes are supported, polymorphism will always be supported | |
| 15. |
Which among the following best describes polymorphism? |
| A. | It is the ability for a message/data to be processed in more than one form |
| B. | It is the ability for a message/data to be processed in only 1 form |
| C. | It is the ability for many messages/data to be processed in one way |
| D. | It is the ability for undefined message/data to be processed in at least one way |
| Answer» B. It is the ability for a message/data to be processed in only 1 form | |
| 16. |
Selecting appropriate method out of number of overloaded methods by matching arguments in terms of number, type and order and binding that selected method to object at compile time is called? |
| A. | Static binding |
| B. | Static Linking |
| C. | Compile time polymorphism |
| D. | All of the mentioned |
| Answer» E. | |
| 17. |
What will be the Correct statement of the following C# code? |
| A. | The subject class version of a() method gets called using sample class reference which holds subject class object |
| B. | subject class hides a() method of base class |
| C. | The code replaces the subject class version of a() with its math class version |
| D. | None of the mentionedView Answer |
| Answer» E. | |
| 18. |
Correct way to overload +operator? |
| A. | public sample operator + (sample a, sample b)b) public abstract operator + (sample a,sample b)c) public static sample operator + (sample a, sample |
| B. | public abstract operator + (sample a,sample b) |
| C. | public static sample operator + (sample a, sample b) |
| D. | all of the mentioned |
| Answer» E. | |
| 19. |
The capability of an object in Csharp to take number of different forms and hence display behaviour as according is known as ___________ |
| A. | Encapsulation |
| B. | Polymorphism |
| C. | Abstraction |
| D. | None of the mentioned |
| Answer» C. Abstraction | |
| 20. |
Which of the following statements is true? |
| A. | A non-private method in a superclass can be overridden |
| B. | A subclass method can be overridden by the superclass |
| C. | A private method in a superclass can be overridden |
| D. | Overriding isn’t possible in Python |
| Answer» B. A subclass method can be overridden by the superclass | |
| 21. |
Overriding means changing behaviour of methods of derived class methods in the base class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 22. |
A class in which one or more methods are only implemented to raise an exception is called an abstract class. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 23. |
What is the use of duck typing? |
| A. | More restriction on the type values that can be passed to a given method |
| B. | No restriction on the type values that can be passed to a given method |
| C. | Less restriction on the type values that can be passed to a given method |
| D. | Makes the program code smaller |
| Answer» D. Makes the program code smaller | |
| 24. |
What is the biggest reason for the use of polymorphism? |
| A. | It allows the programmer to think at a more abstract level |
| B. | There is less program code to write |
| C. | The program will have a more elegant design and will be easier to maintain and update |
| D. | Program code takes up less space |
| Answer» D. Program code takes up less space | |
| 25. |
Which of the following best describes polymorphism? |
| A. | Ability of a class to derive members of another class as a part of its own definition |
| B. | Means of bundling instance variables and methods in order to restrict access to certain class members |
| C. | Focuses on variables and passing of variables to functions |
| D. | Allows for objects of different types and behaviour to be treated as the same general type |
| Answer» E. | |
| 26. |
Which of the following statement is correct about the C#.NET code snippet given below? public class Sample { public int x; public virtual void fun() { } } public class DerivedSample : Sample { new public void fun() { } } |
| A. | DerivedSample class hides the fun() method of base class. |
| B. | The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object. |
| C. | The code replaces the DerivedSample class version of fun() method with its Sample class version. |
| D. | It is not possible to hide Sample class version of fun() method without use of new in DerivedSample class. |
| Answer» B. The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object. | |
| 27. |
Which of the following can be declared as a virtual in a class? Methods Properties Events Fields Static fields |
| A. | 1, 2, 3 |
| B. | 3, 5 |
| C. | 2, 4 |
| D. | 2, 3, 5 |
| Answer» B. 3, 5 | |
| 28. |
Which of the following modifier is used when a virtual method is redefined by a derived class? |
| A. | overloads |
| B. | override |
| C. | overridable |
| D. | virtual |
| Answer» C. overridable | |
| 29. |
Which of the following statements are correct? All operators in C#.NET can be overloaded. We can use the new modifier to modify a nested type if the nested type is hiding another type. In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator. Method overloading is used to create several methods with the same name that performs similar tasks on similar data types. Operator overloading permits the use of symbols to represent computations for a type. |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 2, 5 |
| D. | 3, 4 |
| Answer» D. 3, 4 | |
| 30. |
In order for an instance of a derived class to completely take over a class member from a base class, the base class has to declare that member as |
| A. | new |
| B. | base |
| C. | virtual |
| D. | overrides |
| Answer» D. overrides | |
| 31. |
Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member? |
| A. | new |
| B. | base |
| C. | overloads |
| D. | override |
| Answer» B. base | |
| 32. |
Which of the following are necessary for Run-time Polymorphism? The overridden base method must be virtual, abstract or override. Both the override method and the virtual method must have the same access level modifier. An override declaration can change the accessibility of the virtual method. An abstract inherited property cannot be overridden in a derived class. An abstract method is implicitly a virtual method. |
| A. | 1, 3 |
| B. | 1, 2, 5 |
| C. | 2, 3, 4 |
| D. | 4 only |
| Answer» C. 2, 3, 4 | |
| 33. |
Which of the following operators cannot be overloaded? true false new ~ sizeof |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 3, 5 |
| D. | All of the above |
| Answer» D. All of the above | |
| 34. |
A derived class can stop virtual inheritance by declaring an override as |
| A. | inherits |
| B. | extends |
| C. | inheritable |
| D. | not inheritable |
| Answer» E. | |
| 35. |
Which of the followings is the correct way to overload + operator? |
| A. | public sample operator + ( sample a, sample b ) |
| B. | public abstract operator + ( sample a, sample b) |
| C. | public abstract sample operator + (sample a, sample b ) |
| D. | public static sample operator + ( sample a, sample b ) |
| Answer» E. | |
| 36. |
Which of the following keyword is used to overload user-defined types by defining static member functions? |
| A. | op |
| B. | opoverload |
| C. | operator |
| D. | operatoroverload |
| Answer» D. operatoroverload | |
| 37. |
Which of the following unary operators can be overloaded? true false + new is |
| A. | 1, 2, 3 |
| B. | 3, 4, 5 |
| C. | 3 only |
| D. | 5 only |
| Answer» B. 3, 4, 5 | |