CS304P Lab Quiz No 4 by @Studywithhamza25
CS304P Lab Quiz No 4 by @Studywithhamza25
LATEST ATTEMPT BY
@studywithhamzA25
WARNING
(Don’t Copy My File)
PAID QUIZ CONTACT
03147094561
LMS HANDLING SERVICES AVAILABLE
Join Whatsapp Group For Latest
Solutions
Join Now
WHATSAPP GROUP1
Join NOW
WHATSAPP GROUP 2
Join NOW
Join WHATSAPP CHANNEL
JOIN NOW
1. Which of the following is the default access specifier
for members of a class?
a. private
b. protected and public
c. public
d. protected and private
2. Which of the following is correct way of declaring the
attribute as a public?
a. class public Student { char *name;};
b. class Student public: { char *name;};
c. class Student { char *name;};
d. class Student { public: char *name;};
3. Which of the given option is not correct for destructor?
a. Destructor is a function with the same name as that of
class but preceded with a tilde ~
b. Destructor is a function with the same name as
that of class, but preceded with a tilde 'void ~'
c. Destructor is used to free the memory allocated
through new operator.
d. Destructor is used to free the memory allocated
through dynamic allocation.
4. Which of the following option is false?
a. Private members can be accessed using friend
functions
b. Public members are accessible from other classes also
c. Member functions can be made private
d. Data members can’t be inherited
5. Following code is equivalent to which option.
a. class Shape
b. {
c. string type;
d. };
e. class Shape { public: string type; };
f. class Shape { private: string type; };
g. class Shape public: { public: string type; };
h. class Shape { protected: string type; };
6. Which of the following is the default access specifier
for members of a class?
a. protected and public
b. private
c. protected and private
d. public
7. Following code is equivalent to which option.
a. class Shape
b. {
c. string type;
d. };
e. class Shape { private: string type; };
f. class Shape { protected: string type; };
g. class Shape { public: string type; };
h. class Shape public: { public: string type; };
8. In classes which of the following is default access
specifier?
a. Private
b. None of the given option
c. Public
d. Protected
9. Which of the following is correct way of declaring the
attribute as a public?
a. class Student public: { char *name;};
b. class Student { char *name;};
c. class Student { public: char *name;};
d. class public Student { char *name;};
10. Which of the given option is not correct for
destructor?
a. Destructor is a function with the same name as
that of class, but preceded with a tilde 'void ~'
b. Destructor is used to free the memory allocated
through new operator.
c. Destructor is a function with the same name as that of
class but preceded with a tilde ~
d. Destructor is used to free the memory allocated
through dynamic allocation.
11. Which statement is true about life of a static data
member?
a. Static data members are destroyed when single object of a class is destroyed.
b. Static members are destroyed dynamically.
c. Static data member exists only within the scope of the class constructor.
d. They remains in memory even if all objects are
destroyed.
12. Which of the following option correctly declares a
static variable ‘x’ ?
a. int static x;
b. static x int;
c. int x static;
d. static int x;
13. Static data members are shared by _____ of the
class.
a. Private data members
b. Public data members
c. Protected data members
d. All types of data members
THANK YOU!