DOC PREVIEW
UD CISC 181 - Class1Clicker-Questions

This preview shows page 1-2-3-18-19-36-37-38 out of 38 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009Slide 2Slide 3True/FalseSlide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 381CISC181 Introduction to Computer ScienceDr. McCoyLecture 19Clicker QuestionsNovember 3, 2009If a class is named MyClass, what must theconstructors be named?(a) Initializer(b) MyClass(c)Any name the programmer wishes except the name of the class(d)~MyClass(e)None of the above.2Referencing elements outside the array bounds(a) can result in changes to the value of an unrelated variable(b) is impossible because C++ checks to make sure it does not happen(c) is a syntax error(d) enlarges the size of the array3True/FalsePointer variables are just memory addresses and can be assigned to one another without regard to type.4True/FalsePointer variables are just memory addresses and can be assigned to one another without regard to type.Answer: FalseExplanation: A pointer variables, like everything else in C++ is typed, and that typing is enforced strongly. A pointer variable of type double* cannot normally hold a pointer value of type int* for example.5Strings cannot(a) be initialized using string literals(b) grow or shrink dynamically(c) be initialized with initializer lists(d) be treated as arrays of characters6Three of the following expressions have the same value. Which of the following’svalue is different from the others?(a) *&Ptr(b) &*Ptr(c) *Ptr(d) Ptr7An array name is(a) a nonconstant pointer to nonconstant data(b) a nonconstant pointer to constant data(c) a constant pointer to nonconstant data(d) a constant pointer to constant data8A class may contain multiple constructors if(a) they have different names.(b) they have different argument lists.(c) they have the same argument list.(d) they have different return types.9Classes do not have the property of(a) encapsulating data.(b) information hiding.(c) containing both data and functions.(d) usually knowing how other classes are implemented.10Assuming that t is an array and tPtr is a pointer to that array, what expressionrefers to the address of the fourth element?(a) *( tPtr + 3 )(b) tPtr[ 3 ](c) &t[ 3 ](d) *( t + 3 )11Which of the following is not true of a constructor and destructor of the same class?(a) they both have same name aside from the tilde (~) character.(b) they are both called once per object (in general).(c) they both are able to accept default arguments.(d) both are called automatically, even if not defined in the class.12Which of the following is not a valid way to pass arguments to a function in C++?(a) call-by-reference with reference arguments(b) call-by-value(c) call-by-reference with pointer arguments(d) call-by-value with pointer arguments13In the following program segment#ifndef Xrest of program#endif(a) will evaluate the rest of the program if X is already defined.(b) will evaluate the rest of the program if X is not already defined.(c) will evaluate the rest of the program regardless of whether X is defined.(d) will cause a syntax error.14The get and set functions of a class(a) are implicitly defined in the class.(b) are private member functions.(c) cannot modify private data.(d) must be implemented by the programmer.15Member access specifiers (public and private) can appear(a) in any order and multiple times.(b) in any order (public first or private first) but not multiple times.(c) in any order and multiple times, if they have brackets separating each type.(d) outside a class definition.16Which of the following is false about a function being passed an array?(a) it knows the size of the array it was passed(b) it is passed the address of the first element in the array(c) it is able to modify the values stored in the array(d) the array name is passed as an argument17Which of the following operations does not produce a string?(a) char string1[] = “test”;(b) char string1[] = { ‘t’, ‘e’, ‘s’, ‘t’, ‘\0’ };(c) char string1[] = { ‘t’, ‘e’, ‘s’, ‘t’ };(d) char string1[] = “ ”;18Comparing pointers and performing arithmetic on them is meaningless unless(a) they point to members of the same array(b) you are trying to compare and perform arithmetic on the values to which they point(c) they point to arrays of equal size(d) they point to different locations19A default constructor(a) is a constructor with all default arguments(b) is the constructor generated by the compiler when one is not provided by the programmer(c) does not perform any initialization(d) both (b) and (c)20What value does function mystery return when called with a value of 4?int mystery ( int number ) { if ( number <= 1 ) return 1; else return number * mystery( number – 1 );}(a) 1(b) 24(c) 0(d) 421True/FalseThere should eventually be a call to the operator delete on a pointer that points to the memory allocated by each call to new.22True/FalseThere should eventually be a call to the operator delete on a pointer that points to the memory allocated by each call to new.Answer: TrueExplanation: Pointer variables are usually local variables. Memory allocated on the free store using the new operator remains allocated whether you use it or even have a pointer pointing to it. If the pointer that points to the allocated memory dies with the end of a function or a block, the memory allocated is locked away so that no one can use it until the program terminates.23All of the following could cause a fatal execution-time error except(a) dereferencing a pointer that has not been assigned to point to a specific address(b) dereferencing a pointer that has not been initialized properly(c) dereferencing a 0 pointer(d) dereferencing a nonpointer24Classes cannot(a) be derived from other classes.(b) initialize data members in the class definition.(c) be used to model attributes and behaviors of objects.(d) include objects from other classes as members.25Which of the following is not a property of structs?(a) structs reserve space in memory when they are defined.(b) structs are built using elements of other data types.(c) Members of a struct must have unique names.(d) Structure variables are declared like other variables, except the structure name is usedas the type.26•Member function definitions•(a) always require the binary scope


View Full Document
Download Class1Clicker-Questions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Class1Clicker-Questions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Class1Clicker-Questions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?