MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which data structure cannot have elements of different data types?
A
Array
B
Tuple
C
Record
D
Stack
E
Queue
Explanation: 

Detailed explanation-1: -Array: An array is a data structure that can hold the elements of same type. It cannot contain the elements of different types like integer with character.

Detailed explanation-2: -An array can be of any data type, but can only hold a single data type. Specifically, you can declare an array that holds strings and an array that holds integers, but you cannot declare a single array that holds both strings AND integers.

Detailed explanation-3: -An array is a linear data structure that collects elements of the same data type and stores them in contiguous and adjacent memory locations.

Detailed explanation-4: -Explanation: The answer is Queue. Queue is a data structure in which insertion takes place from one end, and deletion takes place from one end.

Detailed explanation-5: -Since JavaScript arrays can contain different types, we are able to replace any element of an array with any other type.

There is 1 question to complete.