Quiz
C++ classes and linked lists questions
Questions in this quiz (4)
1How many members (data and functions) does the following class have?
{
public:
Rational()
Rational(int, int)
Rational(int)
int getN();
int getD();
friend void display();
private:
int
int- A6
- B7
- C2
- D3
2What is wrong with the following overloaded extraction operator declaration?
istream& operator >>(istream& in, const myClass &object);- Aa. You cannot put the & on the return type
- Bb. Object should not be a pass by reference parameter
- Cc. Object should not be a const parameter
- Dd. nothing
3As defined in the text, the pointer variable head
- Aa. points to the first node in the list.
- Bb. is the first node in the list.
- Cc. is always NULL.
- Dd. is undefined.
4Which of the following loops correctly uses iter as an iterator to move through the
nodes of the linked list?- Aa. for(iter=NULL; iter != NULL; iter=iter->link)
- Bb. for( iter=head; iter != NULL; iter=iter->link)
- Cc. while(iter!=NULL)
iter=iter->link - Dd. while(iter!=NULL)
iter++
Information
- Description
- Quiz on Untitled, created by Adam Fisher on 06/04/2017.
- Author
- Adam Fisher
- Language
- English
- Views
- 0
- Rating
- No ratings yet Rate this quiz