Data structure MCQs:-
- What is an array? a) A collection of items stored at non-continuous memory locations b) A collection of items stored at continuous memory locations c) A collection of items stored at random memory locations d) A collection of items stored in registers
Answer: b) A collection of items stored at continuous memory locations
- How can we declare an array in C? a) By specifying only its size b) By initializing its elements c) By both specifying its size and initializing its elements d) None of the above
Answer: c) By both specifying its size and initializing its elements
- What is the formula for calculating the length of an array? a) LB - UB b) UB - LB c) UB + LB d) LB * UB
Answer: b) UB - LB
- What is the formula for calculating the address of any element in an array given the address of its first element? a) Loc(arr[k]) = base(arr) * k b) Loc(arr[k]) = base(arr) - w * k c) Loc(arr[k]) = base(arr) + w * k d) Loc(arr[k]) = base(arr) / w * k
Answer: c) Loc(arr[k]) = base(arr) + w * k
- How are elements of a two-dimensional array stored in column major order? a) Elements are stored row by row b) Elements are stored column by column c) Elements are stored in random order d) Elements are stored diagonally
Answer: b) Elements are stored column by column
- What is the formula for calculating the address of an element in a two-dimensional array stored in column major order? a) Loc(arr[i][j]) = base(arr) + w (ni + j) b) Loc(arr[i][j]) = base(arr) + w (mj + i) c) Loc(arr[i][j]) = base(arr) - w (ni + j) d) Loc(arr[i][j]) = base(arr) / w (ni + j)
Answer: b) Loc(arr[i][j]) = base(arr) + w (m*j + i)
- What is the formula for calculating the address of an element in a two-dimensional array stored in row major order? a) Loc(arr[i][j]) = base(arr) + w (ni + j) b) Loc(arr[i][j]) = base(arr) + w (mj + i) c) Loc(arr[i][j]) = base(arr) - w (ni + j) d) Loc(arr[i][j]) = base(arr) / w (ni + j)
Answer: a) Loc(arr[i][j]) = base(arr) + w (n*i + j)
- What is a stack? a) A data structure that stores elements at non-continuous memory locations b) A data structure that stores elements at continuous memory locations c) A data structure that stores elements in registers d) A linear data structure that follows a particular order in which the operations are performed
Answer: d) A linear data structure that follows a particular order in which the operations are performed
- What is the order followed by a stack? a) Random order b) First In First Out (FIFO) c) Last In First Out (LIFO) d) None of the above
Answer: c) Last In First Out (LIFO)
- What does the Push operation in a stack do? a) Removes an item from the stack b) Adds an item to the stack c) Returns the topmost item from the stack
d) Return the first inserted item into the stack
Answer : c) Return the topmost item from the stack
Similar posts:-
- C-programming MCQs part-1
- C-programming MCQs part-2
- C-programming MCQs part-3
- C-programming MCQs part-4
- C-programming MCQs part-5
- C-programming MCQs part-6
- COA MCQs part-1
- COA MCQs part-2
- COA MCQs part-3
- COA MCQs part-4
- Microprocessor 8085 MCQs part-1
- Microprocessor 8085 MCQs part-2
- Microprocessor 8085 MCQs part-3
- CSS MCQs part-1
- CSS MCQs part-2
- CSS MCQs part-3
- CSS MCQs part-4
- CSS MCQs part-5
- Engineering Mathematics -II MCQs part-1
- Engineering Mathematics -II MCQs part-2
- Engineering Mathematics -II MCQs part-3
- Engineering Mathematics -II MCQs part-4
- Engineering Mathematics -II MCQs part-5
- Operating system MCQs part-1
- Operating system MCQs part-2
- Operating system MCQs part-3
- Operating system MCQs part-4
- Operating system MCQs part-5
0 Comments