Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Python Dictionary Practice Exam [HOTS Questions]

Beoordeling
-
Verkocht
-
Pagina's
2
Cijfer
A+
Geüpload op
04-11-2021
Geschreven in
2021/2022

A good brain teaser questions on dictionaries in python coding language,

Instelling
Vak

Voorbeeld van de inhoud

DICTIONARY - REVISION 5

1. Which of the following statements create a dictionary?
a) d = {}
b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”}
d) All of the mentioned

2. Select the correct way to print Emma’s age.
student = {1: {'name': 'Emma', 'age': '27', 'sex': 'Female'},2: {'name': 'Mike', 'age': '22',
'sex': 'Male'}}
a) student[0][1]
b) student[1][“age”]
c) student[0][“age”]

3. Which of the following will delete key_value pair for key="tiger" in dictionary?

dic={"lion":"wild","tiger":"wild","cat":"domestic","dog":"domestic"}

a) del dic["tiger"]
b) dic["tiger"].delete()
c) delete(dic.["tiger"])
d) del(dic.["tiger"])

4. Which of the following are true of Python dictionaries:

a) A dictionary can contain any object type except another dictionary.
b) All the keys in a dictionary must be of the same type.
c) Items are accessed by their position in a dictionary.
d) Dictionaries can be nested to any depth.
e) Dictionaries are mutable.
f) Dictionaries are accessed by key.

5. Write a function that creates a dictionary where the key is the number from 1 to n and
values have the message "Odd" or "Even" next to each number.
Example : If n=5 then the dictionary is
D={1:"Odd",2:"Even",3:"Odd"……}
6. Write a function that takes a dictionary student as parameter where the key is the name
of the students and the value is his percentage. This functions transfer the contents of
Dictionary Student to Dictionary Toppers if their percentage is above 90
7. Write a function that takes a string as the parameter and creates a dictionary that keeps
the track of the alphabets present in the string along with its count.
Example if the string is OCCURRENCE then the dictionary must be
{"O":1,"C":3,"U":1,"R":2,"E":2,"N":1}

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
4 november 2021
Aantal pagina's
2
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Antwoorden

Onderwerpen

$5.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
Stevendurby

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
Stevendurby Vellore Institute of Technlogy
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
4 jaar
Aantal volgers
0
Documenten
6
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen