Data Types Flashcards

1
Q

Strings are mutable or immutable?

A

immutable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Lists are mutable or immutable?

A

mutable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Tuples are mutable or immutable?

A

immtable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

in string indexing, str[-1] refers to what?

A

the las character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the use of List.append()?

A

add elements to list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is diffrent between list.append() and list.insert() ?

A

append() method only works for addition of elements at the end of the List, for addition of element at the desired position, insert() method is used. Unlike append() which takes only one argument, insert() method requires two arguments(position, value).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the use of List.extend()?

A

used to add multiple elements at the same time at the end of the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how sums up list number?

A

sum(list)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is Set ?

A

Set is an unordered collection of data type that is iterable, mutable and has no duplicate elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is major adavantage f using a set over list?

A

The major advantage of using a set, as opposed to a list, is that it has a highly optimized method for checking whether a specific element is contained in the set , removing duplicates from a sequence, and computing mathematical operations such as intersection, union, difference, and symmetric difference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is the diffrence between array and list

A

If you create arrays using the array module, all elements of the array must be of the same type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is Dictionary?

A

Dictionary in Python is an unordered collection of data values, used to store data values like a map, which unlike other Data Types that hold only single value as an element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is advantage of key:value pair in dictaionary?

A

Dictionary holds key:value pair. Key value is provided in the dictionary to make it more optimized.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly