Set - 6

Question 1 :

What do you mean by Stack unwinding?

Answer :

It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.


Question 2 :

Define precondition and post-condition to a member function?

Answer :

Precondition: A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold. For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation. Post-condition: A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false. For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.


Question 3 :

What are the conditions that have to be met for a condition to be an invariant of the class?

Answer :

* The condition should hold at the end of every constructor.
* The condition should hold at the end of every mutator (non-const) operation.


Question 4 :

What is an orthogonal base class? 

Answer :

If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty.


Question 5 :

What is a node class?

Answer :

A node class is a class that,
* relies on the base class for services and implementation,
* provides a wider interface to the users than its base class,
* relies primarily on virtual functions in its public interface
* depends on all its direct and indirect base class
* can be understood only in the context of the base class
* can be used as base for further derivation
* can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.


Question 6 :

What is a container class? What are the types of container classes? 

Answer :

A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.


Question 7 :

What is polymorphism? 

Answer :

Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.


Question 8 :

How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

Answer :

You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.


Question 9 :

How can you tell what shell you are running on UNIX system?

Answer :

You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.


Question 10 :

What is Boyce Codd Normal form?

Answer :

A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one of the following holds: 

* a->b is a trivial functional dependency (b is a subset of a)
* a is a superkey for schema R


Question 11 :

What is pure virtual function?

Answer :

A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration


Question 12 :

Write a Struct Time where integer m, h, s are its members 

Answer :

struct Time{
	int m;
	int h;
	int s;
};

 


Question 13 :

How do you traverse a Btree in Backward in-order?

Answer :

Process the node in the right subtree
Process the root
Process the node in the left subtree


Question 14 :

What is the two main roles of Operating System?

Answer :

As a resource manager
As a virtual machine


Question 15 :

In the derived class, which data member of the base class are visible? 

Answer :

In the public and protected sections.


Question 16 :

Could you tell something about the Unix System Kernel? 

Answer :

The kernel is the heart of the UNIX openrating system, it's reponsible for controlling the computer's resouces and scheduling user jobs so that each one gets its fair share of resources.


Question 17 :

What are each of the standard files and what are they normally associated with?

Answer :

They are the standard input file, the standard output file and the standard error file. The first is usually associated with the keyboard, the second and third are usually associated with the terminal screen.


Question 18 :

Give 4 examples which belongs application layer in TCP/IP architecture? 

Answer :

FTP, TELNET, HTTP and TFTP


Question 19 :

What's the meaning of ARP in TCP/IP? 

Answer :

The "ARP" stands for Address Resolution Protocol. The ARP standard defines two basic message types: a request and a response. a request message contains an IP address and requests the corresponding hardware address; a replay contains both the IP address, sent in the request, and the hardware address.


Question 20 :

What is a Makefile? 

Answer :

Makefile is a utility in Unix to help compile large programs. It helps by only compiling the portion of the program that has been changed. 
A Makefile is the file and make uses to determine what rules to apply. make is useful for far more than compiling programs.