Question
Question 1 The preprocessor executes before the compiler. True or False Question 2 What code is human-readable and follows the standards of a programming language?
Question 1
The preprocessor executes before the compiler. True or False
Question 2 What code is human-readable and follows the standards of a programming language?
None of these , Key code, Secret code, Source code, Machine code ,
Question 3 What is the symbol that marks the beginning of a one line comment?
Question 4 What symbol marks a preprocessor directive?
Question 5 A statement that may be used to stop the current loop and continue with the statement following the loop:
return ,continue ,break ,next ,stop ,terminate ,
Question 6 What is the output of the following loop? int x = 0; while (x++ < 5) { cout << x << " "; }
0 1 2 3 4 5 or 1 2 3 4 5 or 0 1 2 3 4 or 1 2 3 4
Question 7 Consider the following function: double calculate(double x = 1.0, double y = 10.0, string s = "none"); The following is a valid function call to the function above where x and y would be provided by the default arguments: calculate("big");
True or False
Question 8 This type of variable is defined inside a function and is not accessible outside the function.
global or static or local or pointer or None of these or preprocessor directive
Question 9 A while loop can be re-written as a:
for loop recursive function do-while loop
Question 10 Object-Oriented Programming focuses on classes and objects. True False
Question 11 A class is a(n) __________ of an object. pointer blueprint function variable None of these instance Flag this Question
Question 12 Inheritance means ____________________________ creating an instance of a class passing arguments to a function a class is derived from another class assigning an object of a subclass to a variable declared as super class hiding the internals of a class
Question 13 Information Hiding means ________________ a class is derived from another class assigning an object of a subclass to a variable declared as super class hiding the internals of a class passing arguments to a function creating an instance of a class
Question 14 The constructor function's return type is void the class any typed defined by the programmer No return type
Question 15 A constructor is a special function that must always be explicitly defined can only be called from within a class instantiates a class creates a class
Question 16 A __________ member function may be called from a statement outside the class. None of these static class public private
Question 17 If you use the keyword virtual in a function declaration, the function may be overridden in derived classes. True False
Question 18 Any function declared as public may be overridden in subclasses. True False
Question 19 Mark everything that is inherited when a class derives from another class. public member functions static member functions private member functions constructor(s) static member variables private member variables public member variables
Question 20 The _____________ is more general than the _________ . derived class, base class instance class, static class static class, instance class base class, derived class
Question 21 Overloading and overriding are different terms for the same feature. True False
Question 22 If a base class has public member functions that are not listed by a derived class, then these functions are always private to the derived class are inherited unchanged in the derived class do not exist in the derived class are not available to the derived class
Question 23 Polymorphism refers to overriding base class functions None of these the ability to assign objects of subclass types to object pointer variables of superclass types overloading functions
Question 24 Assume a base class has a non-virtual member function named run(). If an object pointer ptr declared as the base class is pointing to an object of a derived class, then the code ptr->run( ); calls it causes a run-time error the derived print function both the derived and base print functions the base class print function
Question 25 Operators can be overloaded in C++ True False
Question 26 A default constructor cannot have more than _____ parameters.
Question 27 What is the output of the following program? #include #include using namespace std; class A { public: virtual void print() { cout << "A.print() "; } }; class B : public A { public: virtual void print() override { cout << "B.print() "; } }; int main() { A* obj = new B(); obj->print(); return 0; } Nothing B.print() an object of class B cannot be assigned to a pointer variable of type A A.print() None of these
Question 28 In which case would you consider using a dynamic array? If the array is small, and the size is known before the program runs. If the program needs to get the size of the array from the user If the array size is big, but known at compile time You should always use a dynamic array
Question 29 If p1 and p2 are both pointers that point to integers in memory, the condition p1==p2 will be true if the values that are in those memory locations are the same. True False
Question 30 A member function of a class should be made private only if it will never be used if it will only be used by other members of the class never, it is illegal to make a member function private. always
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started