Cognizant Interview Questions and Answers

This website contains Cognizant interview questions with answers. We have given Cognizant interview questions faced by freshers and experienced in real interviews in IT industries.

1. What is a pointer? Define it?

Answer:-Pointer is a variable which stores the address of other variables which hold some value in it. Directly pointer is used to point values of variables indirectly. We can manipulate its values.


2. Can you explain memory leaks?

Answer:- A memory leak occurs when objects available in a heap are not utilised. The garbage collector fails to remove it from memory. Hence these objects are kept in the memory unnecessarily.
Memory leaks can lead to performance issues and are bad for the application's health.


3. What is the fill factor in SQL? What is its default value?

Answer:- The fill factor is the percentage of space on each leaf-level page that will be filled with data. The smallest unit in SQL Server is a page, which is made up of 8K pages. Depending on the size of the row, each page can store one or more rows. The Fill Factor's default value is 100, which is the same as the value 0. The SQL Server will fill the leaf-level pages of an index with the highest number of rows it can fit if the Fill Factor is set to 100 or 0. When the fill factor is 100, the page will have no or very little vacant space.


4. What is a dangling pointer in C?

Answer:- Dangling pointer is a pointer which does not point to a valid object of the appropriate type. It appears when a pointer is in the stack but not in the memory in a heap. Char *p =NULL; A dangling pointer attempt to deallocate without allocating space will result in a segmentation fault.
Dangling pointers arise during object destruction, when an object that has an incoming reference is deleted or deallocated, without changing the data of the pointer, so that the pointer points to the memory location of the deallocated memory.


5. When does a checkpoint occur in DBMS?

Answer:- A checkpoint reduces the amount of work during a restart in event of subsequent crashes. These help in the recovery of database after the system crashes. We use checkpoints when we need to restart the system due to a system crash. This ensures that we do not need to perform transactions from the start.


6. Explain the mark and sweep algorithm?

Answer:- Objects are that dynamically created are stored in the heap memory. If objects are created without management, the memory will exhaust, crashing the system.
Mark and Sweep algorithm is a garbage collection algorithm. It works in 2 phases.
In the first phase, the algorithm detects the unused objects in the memory, while in the second phase, these objects are removed from the memory to reclaim the wasted space.


7. What factors influence whether or not a detection algorithm is required in a deadlock avoidance system?

Answer:- One of the factors is that it is dependent on how frequently a deadlock is likely to occur when this algorithm is implemented. The other is the number of processes that will be affected by deadlock if this algorithm is used.


8. What is the size of the integer data type?

Answer:- Size of it is 2 Byte or 4 Byte.


9. What is recursion?

Answer:- The process by which a method calls itself directly or indirectly, again and again, is called recursion and the corresponding function.


10. What is a bootloader?

Answer:- The bootloader is an essential component in the booting process of the OS. It is also called the boot manager. It places the Operating System in the memory.





Discussion



* You must be logged in to add comment.