CIS170C_Week6_Quiz.docx

30 July, 2024 | 3 Min Read

Score for this attempt: 20 out of 20

Submitted Aug 10 at 12:45am This attempt took 13 minutes.

Question 1

2 / 2 pts

( TCO 11) In OOP terminology, an object’s member variables are often called its

activities.

methods.

attributes.

values.

Chapter 13

Question 2

2 / 2 pts

(TCO 11) A _____ is a member function that is automatically called when a class object is created.

static

utility

destructor

constructor

Chapter 13

Question 3

2 / 2 pts

(TCO 11) If you do not declare an access specification, the default for members of a class is

global.

private.

public.

inline.

Chapter 13

Question 4

2 / 2 pts

( TCO 2) Assuming that Polygon is a class name, the statement

Polygon *BoxPtr;

declares an object of class Polygon.

defines a Polygon pointer variable called BoxPtr.

is illegal in C++.

assigns the value of *BoxPtr to the object Polygon.

Chapter 13

Question 5

2 / 2 pts

( TCO 11) The constructor function always has the same name as the

public data member.

first object of the class.

an private data member.

class.

Chapter 13

Question 6

2 / 2 pts

(TCO 11) For the following code, which statement is NOT true? class Point

        {             private:

           double y;                double z;             public:                double x;

        };

x, y, and z are called members of the class.

z is available to code that is written outside the class.

x is available to code that is written outside the class.

The name of the class is Point.

Chapter 13

Question 7

2 / 2 pts

( TCO 11) Assume that myCar is an instance of the Car class, and that the Car class has a member function named park. Which of the following is a valid call to the park member function?

myCar.park();

myCar:park();

car->park();

myCar::park();

Chapter 13

Question 8

2 / 2 pts

( TCO 11) What is the output of the following program?

        \#include \<iostream>

        using namespace std;



        class TestClass

        {             public:

            TestClass(int x)

            { cout \<\< x \<\< endl; }



            TestClass()

            { cout \<\< "Hello!" \<\< endl; }

        };

         int main()

        {

            TestClass test(77);                 return 0;             }

Hello!

The program runs but with no output.

x

77

Chapter 13

Question 9

2 / 2 pts

( TCO 11) The following is a function header for a member function. What is the name of the function? void Rectangle::getArea()

::

void

getArea

rectangle

Chapter 13

Question 10

2 / 2 pts

( TCO 11) _____ programming is centered around functions or procedures.

Encapsulated

Object-oriented

Procedural

Easy

Chapter 13

Quiz Score: 20 out of 20

Powered by TCPDF (www.tcpdf.org)

Related posts