question archive QUESTION 1) What is the output of print(tuple[2:]) if tuple = ( 'abcd', 786 , 2

QUESTION 1) What is the output of print(tuple[2:]) if tuple = ( 'abcd', 786 , 2

Subject:Computer SciencePrice:4.87 Bought7

QUESTION 1) What is the output of print(tuple[2:]) if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?

   

( 'abcd', 786 , 2.23, 'john', 70.2 )

   

abcd

   

(786, 2.23)

   

(2.23, 'john', 70.2)

QUESTION 2

What is the output of print(tuple[-3:]) if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?

   

( 'abcd', 786 , 2.23, 'john', 70.2 )

   

abcd

   

(786, 2.23)

   

(2.23, 'john', 70.2)

QUESTION 3

when referencing the first index value within a list, in reference to the last element’s position, we begin with an index of:

   

0

   

1

   

-1

   

any value

QUESTION 4

Dictionaries use what to uniquely identify each of its elements.

   

name

   

index

   

value

   

fractional index

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

1)

The given tuple is as follows:

Index

0

1

2

3

4

Index

(reference to the last element’s position)

-5

-4

-3

-2

-1

Value

'abcd'

786

2.23

'john'

70.2

The index referencing 2: means 2nd element to last element.

Therefore “print(print(tuple[2:]))” prints (2.23, 'john', 70.2)

2)

The index referencing -3: means , -3 element to last element.

Therefore “print(print(tuple[2:]))” prints “ (2.23, 'john', 70.2)”

3)

When referencing the elements with respect to the last element’s position, we start with the index of the last element, that is -1.

There for the index of the beginning element is “ -1”.

4)

Unlike lists, dictionaries are unordered sets of elements. Each element in the dictionary is associated with a key(name).Since dictionary does not support indexing, keys(names),are used to uniquely identify the elements.

Therefore the correct option is “name”.