MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What does this program print?heights = [65, 56, 67, 48, 64]heights.sort()heights.extend([60, 61, 62])heights.remove(67)print(heights)
A
[48, 56, 64, 65, [60, 61, 62]]
B
[48, 56, 60, 61, 62, 64, 65]
C
[48, 56, 64, 65, 60, 61, 62]
D
The program will error.
Explanation: 

Detailed explanation-1: -For example, if a program expects an Integer value for an input but the user enters a String value instead, an InputMismatchException is thrown.

Detailed explanation-2: -The datatypes like int, float, bool, str, tuple, and Unicode are immutable. Datatypes like list, set, dict are mutable.

Detailed explanation-3: -A tuple is a built-in data structure in Python that is an ordered collection of objects. Unlike lists, tuples come with limited functionality. The primary differing characteristic between lists and tuples is mutability. Lists are mutable, whereas tuples are immutable.

Detailed explanation-4: -Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and unchangeable.

There is 1 question to complete.