CS 162 Lecture Notes - Lecture 13: Member Variable, Data Type, Include Directive
CS 162 – Lecture 13 – Exam 1 Review
• All multiple choice and T/F
• What value will the function eof return if there are more characters to be read in the
input stream?
o False
• It is possible for a structure variable to be a member of another structure variable?
o True
▪ Has a/contains relationshipe
• What will inFile.fail() return if the file associated with the stream inFile cannot be
opened?
o True
▪ If have to know general algorithm, not syntax of File I/O
• The data members of a class are usually placed in the private section of a class.
o True
▪ We do’t at other people to ess ith our data eers.
• The expression s->m; indicates that s is a structure pointer and m is a structure member.
o True
▪ S is pointer, use dot operator to get to m
▪ (*s).m is same thing
• If the implementation of a member function calls another member function, you do not
need to use dot notation.
o True
▪ If we are still declaring class, we can call by name, all in same scope
▪ Outside of class, need to use dot operator
• A constructor cannot specify a return type.
o True
▪ No return type, not even void
▪ Same as copy constructor, destructor, etc.
find more resources at oneclass.com
find more resources at oneclass.com
• The implementation of the member functions cannot access the private sectin of the
class.
o False
▪ Can still access it inside
• Object-Oriented design first identifies the objects required in a problem.
o True
▪ Programs run off of objects
• In object-oriented design, it is considered a correct procedure to implememnt a little,
then test.
o True
▪ Regardless of object-oriented, good practice
▪ Right a little bit of code, then compile to test
▪ Do not write 100s or 1000s lines of code without compiling along the way
• When passing a file stream object to a function, you should always pass it by reference.
o True
• You must use the private access specification for all data members of a class.
o False
▪ Know how others can use it
• By default, when an object is assigned to another, each member of one object is copied
to its counterpart in the other object.
o True
▪ Shallow copy
▪ Do not want pointing to two objects on the heap
▪ Destination object should have own money to work with
• A static member variable can be used when there are no objects of the class in
existence.
o True
▪ Need to scope to have access
▪ Ojet does’t eed to exist to do that
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Cs 162 lecture 13 exam 1 review: all multiple choice and t/f, what value will the function eof return if there are more characters to be read in the input stream, false. It is possible for a structure variable to be a member of another structure variable: true, has a/contains relationshipe, what will infile. fail() return if the file associated with the stream infile cannot be opened, true. If the implementation of a member function calls another member function, you do not need to use dot notation: true. Ifstream is read: class type declarations (the class interface) are usually store here. h files: a class is a _______ that is defined by the programmer, data type, user defined data type, abstract datatype. It would work without second const: the first line of the implementation file time. cpp for a class called time could bep, #i(cid:374)(cid:272)lude (cid:862)ti(cid:373)e. h(cid:863)