Mark the correct/incorrect assertions about pointers.
(yes) A pointer denotes the location of a value in memory.
(no) Pointer arithmetic means to add an address to an array pointer.
Mark the correct/incorrect pointer definitions.
(yes) int* p = new int;
(no) int pp = new int;
We have the following variable definitions:
Mark the correct/incorrect assignment statements.int* ptr1;
int p = 2;
int* ptr2 = new int;
We have the following variable definitions:
Mark with "yes" expressions which have the value 30.int a[3] = {10, 20, 30};
int* pa = a;
Mark the correct/incorrect definitions and initializations about
character pointers and
arrays.
(yes) char hello[] = "Hello";
(no) char one[1] = "1";
We have the following classes:
Mark the correct/incorrect assertions about the classes Point and Circle.class Point { ... };
class Circle :public Point { ... };
We have the following classes definitions:
and objects oa from the class A and ob from the class B. Mark the (syntax) correct/incorrect statements in the body of the main function.class A {
public:
void af();
... };
class B : public A {
public:
void bf();
... };
Suppose the class D
inherits from B. Let
b be an object of the
class B,
d be an object of the
class D,
pb be a pointer of the
class B and
pd be a pointer of the
class D.
Which of the following assignments are legal?
(yes) b = d;
(no) d = b;
Mark the correct/incorrect assertions about virtual functions and
polymorphism.
(yes) Only member functions can be dynamically bound.
(no) Only nonmember functions can be statically bound.
Mark the correct/incorrect assertions about inheritance
hierarchy of stream classes.
(yes) The fstream class
derives from iostream.
(no) The fstream class
derives from ofstream.
Mark the correct/incorrect assertions about stream classes, objects
and
member functions.
(yes) An object of istream
class is a source of bytes.
(no) The object cin
belongs to a class that is derived from ifstream.
We have the following file variables:
and the variables:ifstream fin;
ofstream fout;
fstream f;
Mark the correct/incorrect statements.int k = 1;
double x = 5.5;
char ch = 'Y';
string s = "MyString";