Which concept means the addition of new components to a program as it runs? Which of the following is correct?
b) Member functions This set of C++ Programming Objective Questions & Answers focuses on OOPs Concept 3. c) Constant functions d) All of the mentioned It is necessary to initialize static data. Which statement is true about a static nested class? What is the other name used for functions inside a class? 4. d) An object is an instance of the data type of the class Which of the following is not a type of inheritance? Which of the following is a mechanism of static polymorphism? b) II only Wrapping data and its related functionality into a single entity is known as _____________. Reading the third function call custom_add( int , float ), compiler tries to substitute T with int which leads to custom_add ( int , int ) and with float resulting in custom_add ( float , float ) none of which is a match to an original call. c) It decreases the compilation time View Answer, 14. Operator overloading, Function overloading, and Templates are the mechanisms of static polymorphism. The derived classes have more specialized functionality. View Answer, 15. View Answer, 12. b) Multilevel c) Distributive Compiler reports an error on compilation. Calling function custom_add(c, r) with int c and float r is ambiguous and will result in compile time error. Why references are different from pointers? Which of the following is not a type of inheritance? Which of the following cannot be used with the virtual keyword? They both provide polymorphic behavior during compilation process, both are useful, and both should be in your toolbox. However, calling custom_add(p, e) with int p and float e will cause a compile time error. d) Structure members are private by default c) Both I and II Here are the rules about abstract classes , You cannot create an instance of an abstract class, You cannot declare an abstract method outside an abstract class. Which concept is used to implement late binding? However, you are free to pick the one that either is agreed upon in your working environment or makes more sense to you. b) << Which of the following cannot be used with the keyword. Out of the following, which is not a member of the class? Point to remember: each time you leave something for compiler to deduce make sure there is no room for ambiguity left. In this case, type of input value will be neglected which sometimes can lead to nasty hard-to-debug errors. The same function name has many definitions in the same scope due to function overloading. However, the term polymorphism is used to characterize both compile-time and run-time type so often, that it is hard to avoid describing one or another. Function custom_add() from a previous example works perfectly for adding two numerical values, but adding two chars and getting numerical result makes little sense in given context.
Only derived class function will get called irrespective of object.
Instance functions can call static functions and access static data.
d) It will neither have a constructor or destructor b) It will not have a destructor b) II only Types, Pointers, Arrays & Structures in C++, Functions, Namespaces & Exceptions in C++, Source Files, Classes & Operator Overloading in C++, Derived Classes, Templates & Exception Handling in C++, here is complete set of 1000+ Multiple Choice Questions and Answers, Prev - C++ Programming Questions and Answers OOPs Concept 2, Next - C++ Programming Questions and Answers OOPs Concept 4, C++ Programming Questions and Answers OOPs Concept 4, C++ Programming Questions and Answers OOPs Concept 2, C++ Programming Questions and Answers OOPs Concept 1, Object Oriented Programming using C++ Questions and Answers OOPs Features, C++ Programming Questions and Answers Operator Overloading 1, Object Oriented Programming using C++ Questions and Answers Member Operator Function, C++ Programming Questions and Answers Operator Functions, C++ Programming Questions and Answers Function Call, C++ Programming Questions and Answers Operator Overloading 2, C++ Programming Questions and Answers Functors, Object Oriented Programming MCQ Questions, Dynamic Programming Problems and Solutions. Instead of creating several classes (each for each data type) you can easily apply the previous approach of creating generalized code using a class template. d) Hierarchical 1. Which of the following is not a type of Constructor? (Press Ctrl+g to toggle between English and the chosen language), Question Answer in malayalam-kerala-psc-questions, Multiple Choice Question in malayalam-kerala-psc-questions, Question Answer in kerala-psc-questions-in-malayalam, Multiple Choice Question in kerala-psc-questions-in-malayalam, Question Answer in India-general-knowledge-in-malayalam, Multiple Choice Question in mechanical-engineering-machine-design, Question Answer in kerala-general-knowledge-in-malayalam, Multiple Choice Question in java-programming-inner-classes, Multiple Choice Question in aptitude-surds-and-indices, Multiple Choice Question in current-affairs-2017-01-04, Multiple Choice Question in electronics-capacitors, Multiple Choice Question in electrical-engineering-series-parallel-circuits. Compilers responsibility is to generate code for different input types based on instructions you gave. All rights reserved. The HAVING clause does which of the following? Which of the following is correct about the statements given below? 5. Which of the following class allows to declare only one object of it? How compile-time polymorphisms are implemented in C++? Which operator is overloaded for a cout object? Implementation is completed when a derived class inherits from it. 1.
b) It reduces maintenance cost Correct choice is (d) All of the mentioned. The mechanism of linking a function with an object during compile time is called early binding. Setting up a development environment for Egeria on a Windows machine, Positive feedback as a tool of influence (in a team), The annoying part of APIs with associative arrays, Seeking successful IT projects? You cannot overload function declarations that differ only by return type. View Answer, 13. Learn more. d) Both private and protected c) Protected Electronics and Communication Engineering. a) >> Which of the following explains the overloading of functions? Abstract classes contain abstract methods, which are implemented by the derived class. In static polymorphism, the response to a function is determined at the compile time. In this case, compiler can not decide on which one to use and reports the issue. Static functions can access only static data. By using this website, you agree with our Cookies Policy. Now the idea of polymorphism starts to emerge: you are using the same interface (the same function name) to work with objects of different types. Doing so does not affect operators in generalyou just add yet another definition of the operator to the pool. Which of the following is correct in C++? Which of the following are available only in the class hierarchy chain? View Answer, 10. Which of the following cannot be used with the virtual keyword? Note, our program has two potential candidates, custom_add( float , float ) and custom_add( int , int ) with both functions equally fulfilling (or not fulfilling) the purpose. It might look like you are using the same + sign over and over again although the compiler deduces arguments types, decides which definition of + operator suits best, and puts the chosen version of operator in your code. In dynamic polymorphism, it is decided at run-time. Which of the following is true? Which of the following term is used for a function defined inside a class? and also has a short definition of polymorphic class: A class that declares or inherits a virtual function is called a polymorphic class. As a general rule of thumb, use: Love podcasts or audiobooks? - Check GATE Apply Online Link, Dates & Procedure, GATE 2023 Admit Card Download - Release Date And Download Link, PSU Recruitment Through GATE 2022: Jobs, Eligibility, Selection Process, Indian Coast Guard Previous Year Question Paper. Think of a situation where you need a basic container which would store two values: container for two ints, two chars, two floats, etc. The following program demonstrates this , We make use of cookies to improve our user experience. b) An object is an instance of its class The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. It is also called static binding. When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. b) Structures can have member functions
I) All operators in C++ can be overloaded. d) > #include
To understand why, you need to look at the process of function creation in a step-by-step manner. How many types of polymorphisms are supported by C++? C# provides two techniques to implement static polymorphism.
The virtual functions could be implemented differently in different inherited class and the call to these functions will be decided at runtime.