MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following facts about arrays is TRUE?
A
Lists can contain items of different data types
B
Arrays can only contain items of a single data type
C
Lists and arrays are the same thing
D
A list is a type of variable
Explanation: 

Detailed explanation-1: -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-2: -Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type i.e. 1. All elements of an array can be Integers.

Detailed explanation-3: -No, we cannot store multiple datatype in an Array, we can store similar datatype only in an Array.

Detailed explanation-4: -The data type of the array. This is also known as the element type. Supported data types are: BINARY, BIT, CHAR, VARCHAR, DATE, DECIMAL, DOUBLE PRECISION, FLOAT, INTEGER, NUMERIC, REAL, SMALLINT, TIME, TIMESTAMP, TIMESTAMP TZ, TINYINT, and VARBINARY . An unsigned integer, indicating the array’s maximum element size.

There is 1 question to complete.