1. Homepage
  2. Exam
  3. CPT106 SEMESTER 2021/22 Resit Exam - Question 1

CPT106 SEMESTER 2021/22 Resit Exam - Question 1

This question has been solved
Engage in a Conversation

 
CourseNana.COM

2nd SEMESTER 2021/22 Resit Exam CourseNana.COM

Undergraduate – Year 2 CourseNana.COM

C++ Programming and Software Engineering II CourseNana.COM

Exam Duration:   2 Hours CourseNana.COM

  CourseNana.COM

  CourseNana.COM


CourseNana.COM

  CourseNana.COM

INSTRUCTIONS TO CANDIDATES CourseNana.COM

  CourseNana.COM

1、    This is an open book resit exam. Please complete the exam independently and honestly. CourseNana.COM

2、    The total marks available are 100. CourseNana.COM

3、    Answer all questions in the answer booklet and submit it to LMO. There is NO penalty for providing a wrong answer. CourseNana.COM

4、   The duration is 2 hours. CourseNana.COM


  CourseNana.COM

  CourseNana.COM

Q1 CourseNana.COM

Multiple choice. Select the correct option. CourseNana.COM

Total 30 CourseNana.COM

  CourseNana.COM

a) CourseNana.COM

Which of the following statements is NOT correct? CourseNana.COM

a.     Low coupling often correlates with high cohesion. CourseNana.COM

b.     Coupling is a measure of the amount of interaction between modules. CourseNana.COM

c.     Cohesion is a measure of the amount of interaction between action and information within a module. CourseNana.COM

d.     High coupling is much better than high cohesion. CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

b) CourseNana.COM

The most restrictive the access modifiers are: CourseNana.COM

  CourseNana.COM

a.  Private. CourseNana.COM

b.  Protected CourseNana.COM

c.  Public. CourseNana.COM

d.  None of above CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

c) CourseNana.COM

There is a pointer double *a. Which of the following is a possible correct output for the statement cout<<sizeof(a)? CourseNana.COM

  CourseNana.COM

a.  16 CourseNana.COM

b.  2 CourseNana.COM

c.  4 CourseNana.COM

d.  12 CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

d) CourseNana.COM

Assuming that t is an array and p is a pointer to that array, which expression does not refer to the value of element 3 of the array? CourseNana.COM

  CourseNana.COM

a. *(p + 3) CourseNana.COM

b. p[3] CourseNana.COM

c. &t[3] CourseNana.COM

d. *(t + 3) CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

e) CourseNana.COM

The has-a relationship represents. CourseNana.COM

  CourseNana.COM

a.  Composition. CourseNana.COM

b.  Inheritance. CourseNana.COM

c.  Information Hiding. CourseNana.COM

d.  Aggregation. CourseNana.COM

(2) CourseNana.COM


CourseNana.COM

  CourseNana.COM

f) CourseNana.COM

  CourseNana.COM

Variables defined inside a class but outside a function have: CourseNana.COM

  CourseNana.COM

a.  File scope. CourseNana.COM

b.  Class scope. CourseNana.COM

c.  Block scope. CourseNana.COM

d.  Class or block scope, depending on whether the binary scope resolution operator (::) is used. CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

g) CourseNana.COM

Files ending in .cpp are known as                  files. CourseNana.COM

  CourseNana.COM

a.  Executable CourseNana.COM

b.  Binary CourseNana.COM

c.  Source-code CourseNana.COM

d.  Header CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

h) CourseNana.COM

Which of the following is not a correct way to initialize an array? CourseNana.COM

  CourseNana.COM

a. int n[5]{7, 0, 3, 8, 2}; CourseNana.COM

b. float n[]{7, 0, 3, 8, 2}; CourseNana.COM

c. char n[]{“7”, “a”}; CourseNana.COM

d. double n[5]{1, 2}; CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

i) CourseNana.COM

Given the class definition: CourseNana.COM

  CourseNana.COM

class Myclass{ public: CourseNana.COM

Myclass () {} CourseNana.COM

Myclass (int n) {cout << "constructor called, ";} CourseNana.COM

~ Myclass () {cout << "destructor called, ";} CourseNana.COM

}; CourseNana.COM

What will the following program output? CourseNana.COM

  CourseNana.COM

int main(){ MyClass c1(1); MyClass c2; MyClass *p; return 0; CourseNana.COM

} CourseNana.COM

a.  constructor called, destructor called, constructor called, destructor called, CourseNana.COM

b.  constructor called, destructor called, destructor called, CourseNana.COM

(2) CourseNana.COM


  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

c.  constructor called, destructor called, destructor called, destructor called, CourseNana.COM

d.  constructor called, constructor called, destructor called, destructor called, CourseNana.COM

  CourseNana.COM

  CourseNana.COM

j) CourseNana.COM

Which of the following statements is not correct? CourseNana.COM

  CourseNana.COM

a.  A class can be derived from more than one classes. CourseNana.COM

b.  The idea of inheritance implements the is a relationship. CourseNana.COM

c. A class can have one or more constructors. CourseNana.COM

d.  We can create an object from an interface. CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

k) CourseNana.COM

Which of the following has a stream associated with it? CourseNana.COM

  CourseNana.COM

a.     cerr. CourseNana.COM

b.     cin. CourseNana.COM

c.     cout. CourseNana.COM

d.     All of the above have streams associated with them. CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

l) CourseNana.COM

  CourseNana.COM

Which of the following member function definitions is correct? CourseNana.COM

  CourseNana.COM

a. Always require the scope resolution operator (::). CourseNana.COM

b.   Require the scope resolution operator only when being defined outside of the definition of their class. CourseNana.COM

c.  Can use the scope resolution operator anywhere, but become public functions. CourseNana.COM

d.  Must use the scope resolution operator in their function prototype. CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

m) CourseNana.COM

  CourseNana.COM

A destructor: CourseNana.COM

  CourseNana.COM

a.  Has no parameters. CourseNana.COM

b.  Each class can define several destructors. CourseNana.COM

c.  Has a return type. CourseNana.COM

d.  Both (a) and (b). CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM

n) CourseNana.COM

  CourseNana.COM

Which of the following statements about Const object is (are) true? CourseNana.COM

  CourseNana.COM

a.  Const object is the same as a normal object. CourseNana.COM

b.  Const object can call any public member functions in the class. CourseNana.COM

c.  Const object cannot be changed. CourseNana.COM

d.  Const object can be changed by calling const functions in the class. CourseNana.COM

(2) CourseNana.COM


  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

o) CourseNana.COM

When deriving a class from a public base class, the public members of the base class become                    and the protected members of the base class become                     ? CourseNana.COM

  CourseNana.COM

a.      protected, private CourseNana.COM

b.      public, private CourseNana.COM

c.      protected, protected CourseNana.COM

d.      public, protected CourseNana.COM

(2) CourseNana.COM

  CourseNana.COM


CourseNana.COM

Get the Solution to This Question

WeChat WeChat
Whatsapp WhatsApp
CPT106代写,C++ Programming and Software Engineering II代写,C++代写,Software Engineering代写,Exam代写,XTJLU代写,CPT106代编,C++ Programming and Software Engineering II代编,C++代编,Software Engineering代编,Exam代编,XTJLU代编,CPT106代考,C++ Programming and Software Engineering II代考,C++代考,Software Engineering代考,Exam代考,XTJLU代考,CPT106help,C++ Programming and Software Engineering IIhelp,C++help,Software Engineeringhelp,Examhelp,XTJLUhelp,CPT106作业代写,C++ Programming and Software Engineering II作业代写,C++作业代写,Software Engineering作业代写,Exam作业代写,XTJLU作业代写,CPT106编程代写,C++ Programming and Software Engineering II编程代写,C++编程代写,Software Engineering编程代写,Exam编程代写,XTJLU编程代写,CPT106programming help,C++ Programming and Software Engineering IIprogramming help,C++programming help,Software Engineeringprogramming help,Examprogramming help,XTJLUprogramming help,CPT106assignment help,C++ Programming and Software Engineering IIassignment help,C++assignment help,Software Engineeringassignment help,Examassignment help,XTJLUassignment help,CPT106solution,C++ Programming and Software Engineering IIsolution,C++solution,Software Engineeringsolution,Examsolution,XTJLUsolution,