C++ Questions

Q:

What could be the bucket size if collision and overlapping occur at same time?

A) 2 B) 0
C) 1 D) 4
 
Answer & Explanation Answer: C) 1

Explanation:

One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 5035
Q:

What do you mean by inline function?

Answer

An inline function is a function that is expanded inline when invoked.ie. the compiler replaces the function call with the corresponding function code. An inline function is a function that is expanded in line when it is invoked. That is the compiler replaces the function call with the corresponding function code (similar to macro)

Report Error

View answer Workspace Report Error Discuss

Subject: C++
Job Role: Software Architect

1 5027
Q:

Which of the following type casts will convert an Integer variable named amount to a Double type ?

A) (int to double) amount B) int (amount) to double
C) int to double(amount) D) (double) amount
 
Answer & Explanation Answer: D) (double) amount

Explanation:
Report Error

View Answer Report Error Discuss

6 5005
Q:

What do you mean by reference variable in c++?

Answer

A reference variable provides an alias to a previously defined variable.


Data type & reference-name = variable name

Report Error

View answer Workspace Report Error Discuss

Subject: C++
Job Role: Software Architect

0 4994
Q:

A special member function of a class, which is invoked automatically whenever an object goes out of the scope is called

A) Constructor B) Destructor
C) Friend function D) None of the above
 
Answer & Explanation Answer: B) Destructor

Explanation:

Destructor is a special member function of a class, which is invoked automatically whenever an object goes out of the scope. It has the same name as its class with a tilde character prefixed.

Report Error

View Answer Report Error Discuss

Filed Under: C++
Job Role: Software Architect

1 4991
Q:

What is the difference between realloc() and free()?

Answer

The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 4988
Q:

What will happen when an exception is not processed?

A) It will eat up lot of memory and program size B) Terminate the program
C) Crash the compiler D) None of the mentioned
 
Answer & Explanation Answer: A) It will eat up lot of memory and program size

Explanation:

As in the case of not using an exception, it will remain useless in the program and increase the code complexity.

Report Error

View Answer Report Error Discuss

Filed Under: C++

2 4969
Q:

Difference between Stack and Queue

Answer

Stack is a collection of objects that works in LIFO (Last in First out) mechanism while Queue is FIFO (First in First out). This means that the object that is inserted first is removed last in a stack while an object that is inserted first is removed first in a queue.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 4942