Monday, 16 October 2017

Multiple Choice Question on Data Structure and Algorithm Design

Q1. A stack is a data-structure in which elements are stored and retrieved by which method:
a. FIFO method
b.LIFO method
c. FCFS method
d. None of the above

Q2. The different types of arrays data structure are:
a. One & Multi-dimensional
b. int and float 
c. int,char,float
d. One & Two dimensional

Q3. An array is passed into a function by:
a. by value
b. by reference
c. element by element
d. Any of the above


Q4. A queue is a data-structure in which elements are stored and retrieved by which method:
a. FIFO method
b.LIFO method
c. FCFS method
d. None of the above

Q5. If an array with the name, X exists then which of the following statements is incorrect:
a. X++
b. printf(“%d”,*(X+1))
c. printf(“%u”,X+1)
d. All are correct

Q6. An uninitialized pointer in any program is known as:
a. dangling pointer
b. NULL pointer
c. generic pointer
d. None of the above

Q7. The unary operator used with pointer variable to indirectly access the contents of memory location pointed to by the pointer is known as
a. Address-of operator  
b. dot operator
c. indirection operator  
d. asterisk operator 

Q8. The arithmetic operation performed on pointer variables is known as:
a. multiplication of an integer with pointer
b. addition of two pointers
c. subtraction of two pointers
d. addition of a float to a pointer

Q9. Two ways to access data elements of an array are:
a. by value and by reference   
b. indexed and pointer notation
c. sequential and random   
d. none of the above

Q10. The functions used for dynamic memory allocation for any data elements is known as:
a. delete and free
b. free and realloc
c. malloc and free
d. malloc and calloc

Q11. An array can be categorized as which type of the following data-structure:
a. dynamic
b. static
c. int/char/float
d. multi-dimensional

Q12. The function used in C to de-allocate a memory block is known as:
a. delete
b. free 
c. malloc
d. realloc 

Q13. A collection of data elements of different data-types is known as:
a. array
b. union
c. structure
d. linked list

Q14. To access data elements of a structure through a pointer, the operator used for that is known as:
a. .
b. ->
c. <-
d. *

Q15. A structure having at-least one of its data members of the same type as the structure itself is known as:
a. reference structure
b. nested structure
c. self-referential structure
d. none of the above

Q16. A one-way list is known as:
a. circular linked list
b. array
c. queue
d. single linked list

Q17. An orphaned block is the result of:
a. memory leak
b. garbage collection
c. free function
d. all of the above

Q18. A ____ pointer  can point to any data-type is known as:
a. NULL pointer
b. void pointer
c. dangling pointer
d. such a pointer does not exist

Q19. If p1 and p2 are pointers of integer type and x is also an integer-type of variable, which of these expressions is valid:
a. p1*x
b. p2+x
c. p1+p2
d.p1*p2

Q20. A linked list can be represented using two ways which are further known as:
a. single and double
b. single and circular
c. static and dynamic
d. any of the above


Thanks
Mukesh Rajput

No comments:

Post a Comment

Thanks
Mukesh Rajput