-
Static Constant Function
Consider a static const function y() that is private member function of a class Y. What do the static and const mean? When could this function be used?
-
Memory Allocation
When is memory allocated for a function of a class? Is it when the program is complied, or only when the function is called?
-
Base Class Pointer with Derived Object
Base class has some virtual method and derived class has a method with the same name. If we initialize the base class pointer with derived object, calling of that virtual method will result in which method being called?
-
Use of C++ in Daily Life
Do you agree or not that "Object Oriented Programming basic paradigms like Abstraction, Encapsulation, Aggregation, Composition, Inheritance, Polymorphism, Templates etc are based and works in a same way as human thinks and behave in our daily life? Justify your answer with very precise and to the point reasons.
-
Register Relation
Why p++ is faster than p+1?
-
Classes
Given the following class, what is syntactically wrong with the implementation of the display function?class Rational{public: Rational( ); Rational(int numer, int denom); Rational(int whole); int getNumerator( ); int getDenominator( ); friend void display(ostream& out, const Rational& value);private: int numerator; int denominator;};void display(ostream& out, const Rational& value){ out
-
STL - Vector
What is the context of one and two after the following frsgment of code is executed?vector one(7, string("one"));vector two(one.begin() + 2, one.end()-3);
-
Operators
In the following code fragment, which is the calling object for the less-than operator?string s1, s2;if( s1 < s2 )Choose one answer. a. s1 b. < c. s2 d. none
-
-
-
Operators
Which of the following operators cannot be overloaded?Choose one answer. a. [ ] b. == c. . d. =
-
Classes
Who can access private data in a class?Choose one answer. a. members of the class b. friends of the class c. everyone d. A and B
-
Diff betweeen static and local
In the below prog,node * q is local to a function add() but it acts as static .how?#includeusing namespace std;class ll{public: struct node{ int data; node *link; }*p;ll(){p=NULL;}int add(int x){ node *q,*r;if(p==NULL){ r=new node; r->data=x; r->link=NULL;q=r; p=q;}else{r=new node;r->data=x;r->link=NULL;q->link=r;q=q->link;}return 0;}void display(){ node *q; q=p;while(q!=NULL){cout
-
Plz explain following program
In the below program ,in function add() node * q is local but it acts as static ie I mean it works correctly how is it possible?#includeusing namespace std;class ll{public: struct node{ int data; node *link; }*p;ll(){p=NULL;}int add(int x){ node *q,*r;if(p==NULL){ r=new node; r->data=x; r->link=NULL;q=r; p=q;}else{r=new node;r->data=x;r->link=NULL;q->link=r;q=q->link;}return 0;}void display(){...
-
-
Two Dimension Array
A two dimension array can also be thought of asChoose one answer. a. Table. b. Array of arrays.c. A file.d. None of the above e. A and B
-
-
Using Templates
What is the disadvantage of using too many templates?
-
Exception handling vs. return values to signal an error
Why we would use exception handling rather than different return values to signal an error?
-
Dynamic Binding
Why is Dynamic binding (regarding DLLs) are considered better in comparison with static binding? What are DLLs and how they work?
C++ Interview Questions
Ans