CS 1337 Final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Should catch block catch all types used by the throw?

A catch block should catch all exception types used by the throw statements within the corresponding try block.

What happens, if you have a catch and you have the three dots and the ellipses, what will that catch? Catch everything

A catch block with an ellipsis (...) will catch any exception that is thrown.

Front of que is left, do enque adn dequee and say this is what ends up!!

A double-ended queue is called a deque

What do we call a double ended que?

A double-ended queue is called a deque.

3-4 operations, pushing and popping, when these operations are done, heres what the stack looks like!!! Left is top of stack

A queue is a First-In-First-Out (FIFO) data structure.

What type of data structure is a stack?

A stack is a Last-In-First-Out (LIFO) data structure.

Virtual function in a base class, do u expect it to be over written in a virtual class

A virtual function in a base class can be expected to be overridden in a derived class.

Access specifiers, know the colon, can they be viewed as filters

Access specifiers (public, protected, private) can be seen as filters that determine the accessibility of class members.

Another question, access specifier, identify how the access specifier affects things that are inherited

An access specifier affects the accessibility of inherited members based on their level of protection (public, protected, private).

Know definition of exhaustive algorithm

An exhaustive algorithm is one that checks all possible solutions to a problem to find the correct one.

what is an iterative design? Can any iterative design also be used as recursive and vice verca?

An iterative design is a repetitive process that uses loops to solve a problem. Most iterative designs can also be implemented using recursion and vice versa, but efficiency and readability may vary.

What does it mean append node to linked list?

Appending a node to a linked list means adding a node to the end of the list.

C++ introduced an option keyword to help prevent subtle errors?

C++ introduced the explicit keyword to help prevent subtle errors.

What do you call the ability to combine data and operations to combine data on a single unit? Inheritance composition? When you combine data to one unit? The answer is encampuslation

Encapsulation is the ability to combine data and operations on that data into a single unit.

Know what exceptions are designed to do

Exceptions are designed to handle unexpected or exceptional situations during program execution in a clean and organized manner.

Are exhaustive algorithms efficient?

Exhaustive algorithms are generally not efficient because they involve searching through all possible solutions.

Given simple recursion,call recursive function with a number, say how many times the message is displayed. Similar to blastoff

Given a simple recursion problem, you should be able to determine how many times a message will be displayed by analyzing the function's logic and the input value provided. For example, if the function has a base case that stops the recursion when the input value reaches zero and you call the function with a value of 5, the message will be displayed five times.

What happens if derived class attempts to override a final base class member function does in the class?

If a derived class attempts to override a final base class member function, a compilation error will occur.

Know what happens if an exception thrown is never caught

If an exception is thrown but never caught, the program will terminate abnormally, and a diagnostic message will be displayed.

If memory cant be allocated, throws bad alloc exception

If memory can't be allocated, C++ throws a std::bad_alloc exception.

Given declaration inside a derived class,identify what the base class is.

In a declaration inside a derived class, the base class is the class that the derived class inherits from.

When u have function template, what are the parameters? What maps to the parameters,the arguments have to be data type

In a function template, the parameters are the template arguments, which can be data types or integral values.

If your doing insertion or deletion routine in LL, how many pointers are u required to create in the transversal process?what are the pointer u need to do the insertion or deletion? Current pointer and trailing pointer.....

In a linked list, you need two pointers to perform insertion or deletion: the current pointer and the trailing pointer.

Simple class definition with a template, angular brackets and the type, ask what the variable is, and u should say its a parameter

In a simple class definition with a template, the variable inside angle brackets is a template parameter.

Another with simple declaration and asks which is derived class

In a simple declaration, the derived class is the one that inherits from another class.

Try catch construct block, the catch must be right after a try block, or does catch have to be right after try?

In a try-catch construct, the catch block must be placed immediately after the try block.

Tricky questions....in general do recursive functions to run faster than iterative loops? So its slower

In general, recursive functions tend to run slower than iterative loops because of the overhead associated with function calls and the potential for increased memory usage due to the call stack.

If I have multiple inheritances and 2 parent classes, can I have members in each base class with the same name?

In multiple inheritance, you can have members with the same name in each base class.

Angular brackets where u define parameter type, can u have more than one parameter in that list?

In the angle brackets where you define the parameter type, you can have more than one parameter.

Know the definition of inheritance does and objected oriented programing

Inheritance in object-oriented programming allows a class to inherit properties and behavior from another class, enabling code reuse and modularity.

Of all the things we learned, object oriented program, what supports reuse of existing base code in the base class by a derived class?

Inheritance supports the reuse of existing base code in the base class by a derived class.

Linked lists are called linked cuz each node is pointed to the next node in the list

Linked lists are called linked because each node points to the next node in the list.

Linked list can insert or delete a note faster than can be done in an array?

Linked lists can insert or delete a node faster than arrays.

Know what multiple inheritance is,just the definition—--more than one base class

Multiple inheritance is when a class inherits from more than one base class.

Know what polymorphism is-generic meaning

Polymorphism, in a generic sense, is the ability of different objects to respond to the same function call in a way that is specific to their types.

Understand polymorphism like definition

Polymorphism, in the context of object-oriented programming, is the ability of different objects to respond to the same function call in a way that is specific to their types.

Given 3 access specifiers, which one will never allow access to its members to the derived class?

Private access specifier will never allow access to its members to the derived class.

Can private base class members, be access by a derived class?

Private base class members cannot be directly accessed by a derived class.

Know what refactoring a function means?

Refactoring a function means modifying its structure or implementation without changing its external behavior or functionality.

Know when static binding occurs

Static binding occurs at compile-time, when the compiler determines which function to call based on the object's declared type.

What does the acrenome ADT stand for?

The acronym ADT stands for Abstract Data Type.

What is the case that gets encountered when a recursive algorithm ends?

The base case is encountered when 72 a recursive algorithm reaches a condition that stops the recursion, allowing the function calls to start returning.

The bottom of stack is where data is put on the stack and taken off the stack?

The bottom of the stack is not where data is put on the stack and taken off; it is the top of the stack where data is added and removed.

What type of data structure is a quee?

The front of the queue is where data is dequeued (removed), while the rear is where data is enqueued (added).

Know order of constructor calls

The order of constructor calls is base class constructor, then derived class constructor.

Push operation, puts data on the stack?

The push operation puts data onto the stack.

What do u call the start of linked list?

The start of a linked list is called the head.

Know the three types of access specifiers

The three types of access specifiers are public, protected, and private.

Know what the throw point is

The throw point is the location in the code where an exception is thrown using the throw keyword.

Is there any difference declaring a template class against object of a template class against object of a regular class?

There is no difference in declaring a template class object compared to a regular class object.

Do throw statements have to be inside try block?

Throw statements do not have to be inside a try block, but it is recommended to use them within a try block.

To delete entire linked list, u must transverse list and delete each node one by one?

To delete an entire linked list, you must traverse the list and delete each node one by one.

Using function template, requires less code than overloading a function. Is it usually less code?

Using function templates usually requires less code than overloading functions.

5 questions, virtual base class, if you see virtual base class, it causes dynamic binding for pointer and references, if not references, uses static binding

Virtual base class causes dynamic binding for pointers and references, 35 while non-virtual base classes use static binding.

What do we call it when we have a public member function in a derived class, and a corresponding must have the same number name and type of parameter?redefine?

When a derived class has a public member function with the same name, number, and type of parameters as a base class member function, it is called overriding.

Given some simple class def, identify what access specifier makes public become public?

When an access specifier makes public members become public in the derived class, it is the public access specifier.

What happens when a exception is thrown by an object of a class and the function ends?

When an exception is thrown by an object of a class and the function ends, the exception propagates up the call stack until it is caught or the program terminates.

When binding is done in run time on a virtual function, what type of binding is that?

When binding is done at runtime on a virtual function, it is called dynamic binding or late binding.

What do you call it when member functions behave diff depending on which object did the call? Poly encap or what^^^

When member functions behave differently depending on which object made the call, it is called polymorphism.

When compiler binds member function with version of function in same class it resides, what type of binding?

When the compiler binds a member function with the version of the function in the same class it resides, it is called static binding or early binding.

What does it mean the head pointer points to null?

When the head pointer points to null, it means the linked list is empty.

When u define structure, did it allocate memory?

When you define a structure, it does not allocate memory. Memory is allocated when an object of the structure is created.

When u have base class and derived class, and u define an object of the classes, which constructor is called first?does it call derived then base or vice versa?

When you define an object of derived and base classes, the base class constructor is called first, followed by the derived class constructor.

When u search for node in LL, where do you have to start

When you search for a node in a linked list, you have to start at the head of the list.

Can a derived class that has a base class, have another class derived from it?

Yes, a derived class can have another class derived from it, creating a chain of inheritance.

Can a derived class have any derived class from it?

Yes, a derived class can have another class derived from it.

Inheritance situation, can derived class pass arguments to base constructor?

Yes, a derived class can pass arguments to a base class constructor using the colon operator in the derived class constructor's definition.

Can a member of derived class, have the same function name as a base class?

Yes, a derived class member can have the same function name as a base class member.

Can a pointer to base class object, be assigned the address of a base class objects

Yes, a pointer to a base class object can be assigned the address of a base class object.

Can more than one class be derived from a base class?

Yes, more than one class can be derived from a base class.

If i have template class, with a name, and i have another object of a class, can the two classes have the same name? It can have the same name

Yes, two classes can have the same name, even if one is a template class and the other is a regular class.

If i have derived class from base class, can u add new data and functions in the derived class?

Yes, you can add new data and functions in a derived class.

If i have try block, can i have multiple catches after the try block with no code between the catches?

Yes, you can have multiple catch blocks after a try block with no code between the catches.

If i have try block, can i have multiple throws in it?

Yes, you can have multiple throw statements inside a try block.

Can i pass a class type to a template?

Yes, you can pass a class type to a template.

When arguments are needed to be passed to base class constructors from derived class, arguments can be from derived constructor header line using the colon operator?

Yes, you can pass arguments to a base class constructor from a derived class constructor using the colon operator.

Can u have function called between a try block and a catch block?

You cannot have a function called between a try block and a catch block. The catch block must immediately follow the try block.

Able to identify throw in a simple code

You should be able to identify a throw statement in a simple code example.


Ensembles d'études connexes

Maternity NCLEX PN, HESI: Pediatric Pharm

View Set

Ecce Romani Exercise IVe Vocabulary

View Set

Introduction to Curriculum, Instruction, and Assessment

View Set

Washington State portion (real estate exam)

View Set