Dsa Viva
Dsa Viva
o fwrite() writes data in binary format, whereas fprintf() writes in text format.
5. How can you store and retrieve data from a binary file?
10. What is the size of a structure? How many pointers does it have?
o The size depends on its data members and memory alignment. A structure may
have multiple pointer members depending on its definition.
o A dynamic data structure where each node points to the next node.
o Each node contains pointers to both the previous and next nodes.
1. What is a stack?
o One (top).
1. What is a queue?
o It is used to group related variables of different data types into a single unit.
o It returns the total memory size occupied by a structure, including any padding
added by the compiler.
o fopen() opens a file, and fclose() closes an open file to free resources.
o Binary files store data in raw form, whereas text files store human-readable data.
10. How do you check if a file opened successfully in C?
o A dynamic data structure where each node contains data and a pointer to the
next node.
o A linked list where the last node points back to the first node instead of NULL.
o It uses two pointers, slow and fast, to detect a cycle in a linked list.
4. What is the difference between iterative and recursive reversal of a linked list?
o Compare node values one by one and merge them in sorted order.
6. What are dummy nodes in linked lists, and why are they used?
o A circular linked list’s last node points to the first node instead of NULL.
4. What are the advantages of a doubly linked list over a singly linked list?
1. What is a stack?
1. What is a queue?
o They manage processes in scheduling algorithms like FCFS and Round Robin.