MCQOPTIONS
Saved Bookmarks
This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structure and Algorithms (DSA) knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Consider the following definition in c programming language |
| A. | ptr=(node*)malloc(sizeof(node)); |
| B. | ptr=(node*)malloc(node); |
| C. | ptr=(node*)malloc(sizeof(node*)); |
| D. | ptr=(node)malloc(sizeof(node)); |
| Answer» B. ptr=(node*)malloc(node); | |
| 2. |
Consider an implementation of unsorted doubly linked list. Suppose it has its representation with a head pointer and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? |
| A. | i and ii |
| B. | i and iii |
| C. | i,ii and iii |
| D. | i,ii,iii and iv |
| Answer» E. | |
| 3. |
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list |
| A. | i and ii |
| B. | i and iii |
| C. | i,ii and iii |
| D. | i,ii and iv |
| Answer» D. i,ii and iv | |
| 4. |
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time? |
| A. | i and ii |
| B. | i and iii |
| C. | i,ii and iii |
| D. | i,ii and iv |
| Answer» C. i,ii and iii | |
| 5. |
A sort which iteratively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called |
| A. | insertion sort |
| B. | selection sort |
| C. | heap sort |
| D. | quick sort |
| Answer» C. heap sort | |
| 6. |
How many times the program will print "Amrutvahini" ? #include |
| A. | infinite times |
| B. | 32767 times |
| C. | 65535 times |
| D. | till stack overflows |
| Answer» E. | |
| 7. |
What will be the output of the program? #include |
| A. | hello |
| B. | hi hello |
| C. | no output |
| D. | infinite loop |
| Answer» B. hi hello | |
| 8. |
What will be output if you will compile and execute the following c code? #include int main(){ |
| A. | -60 |
| B. | -30 |
| C. | 60 |
| D. | garbage value |
| Answer» C. 60 | |
| 9. |
What will be output if you will compile and execute the following c code? #include |
| A. | 12 |
| B. | 8 |
| C. | 4 |
| D. | 1 |
| Answer» B. 8 | |
| 10. |
What is error in following declaration? |
| A. | nesting of structure is not allowed in c |
| B. | it is necessary to initialize the member variable |
| C. | inner structure must have name |
| D. | outer structure must have name |
| Answer» D. outer structure must have name | |
| 11. |
consider the function f defined here: |
| A. | the list is empty or has exactly one element |
| B. | the element in the list are sorted in non-decreasing order of data value |
| C. | the element in the list are sorted in non-increasing order of data value |
| D. | not all element in the list have the same data value |
| Answer» C. the element in the list are sorted in non-increasing order of data value | |
| 12. |
What will be output if you will compile and execute the following c code? |
| A. | 8 |
| B. | \8\ |
| C. | 9 |
| D. | compiler error |
| Answer» E. | |