INSY 3300 Python Final

30 Karteikartenvon Alejandro
Diese Karteikarten lernenKostenlos · Spaced Repetition · iPhone, Android, Mac & Web

Alle Karten

1
What does input() always return?
A string
2
Which operator performs floor division in Python?
  • /
  • //
  • %
  • *
3
What sequence does range(2, 10, 3) produce?
2, 5, 8
4
Which logical operator checks that a value is outside a range?
or
5
How many times does the inner body run for an outer range(3) and an inner range(4)?
  • 7
  • 3
  • 12
  • 4
6
What is a void function?
A function that runs its statements and returns no value (None)
7
What happens if you use a local variable from a different function?
A NameError
8
What does file mode 'w' do to existing contents?
Erases them
9
Which part of try/except runs only when no exception occurs?
  • finally
  • except
  • else
  • try
10
What does list.sort() return?
None, because it sorts in place
11
What does b = a do when a is a list?
Makes b point to the same list, not a copy
12
What is [10, 20, 30, 40, 50][1:4]?
  • [10, 20, 30, 40]
  • [20, 30, 40]
  • [20, 30, 40, 50]
  • [10, 20, 30]
13
Are Python strings mutable or immutable?
Immutable
14
What does find() return when the substring is not found?
-1
15
What does 'hello'[
-1] return?
16
What does d.get('c', 0) return if 'c' is not a key?
0
17
How do you create an empty set?
set(), because {} makes an empty dictionary
18
How do set remove() and discard() differ when the item is missing?
remove() raises KeyError; discard() does not
19
What is {1, 2, 3} ^ {3, 4}?
  • {3}
  • {1, 2, 3, 4}
  • {1, 2, 4}
  • {1, 2}
20
Which file mode is used to unpickle with pickle.load?
'rb'
21
What does __init__ do in a class?
Runs automatically when an object is created and initializes its attributes
22
Which parameter must be the first one in every method of a class?
  • cls
  • this
  • self
  • obj
23
What is an accessor method?
A getter that returns an attribute value without changing it
24
What does class Car(Automobile) mean?
Car inherits from Automobile, an "is a" relationship
25
Which SQLite type corresponds to a Python float?
  • REAL
  • INTEGER
  • TEXT
  • BLOB
26
What must a primary key never be?
NULL, and it must be unique
27
What does cur.fetchone() return when no rows remain?
None
28
Which call saves INSERT, UPDATE and DELETE changes?
conn.commit()
29
Which wildcard in a LIKE pattern matches any characters?
  • ?
  • &
  • #
  • %
30
What does CREATE TABLE IF NOT EXISTS prevent?
An error from recreating an existing table on every run
Alle 30 Karten kostenlos lernen

Mehr Karteikarten: Informatik

A+ Core 1 Domain 1 Acronyms37 KartenInformatik · Englischatalnagiict32 KartenInformatik · EnglischKidistOS Virtualization25 KartenInformatik · Englisch—Griffith—1.2.3 SOFTWARE DEVELOPMENT20 KartenInformatik · EnglischSabs2023Data Storage and Databases15 KartenInformatik · EnglischAyaanSYO-601 Log files10 KartenInformatik · Englischr3lykSoftware Architecture and Quality Attributes (Wk3)209 KartenInformatik · EnglischSamLinux4 Decks · 252 KartenInformatikAndrewNetwork Security: OSPF Routing Protocol83 KartenInformatik · EnglischDiandreiDatabases68 KartenInformatik · EnglischXyzboltCS4432 - Database Query Optimization (Week 6 & 7)55 KartenInformatik · Englischaliciadrei microprocessor 146 KartenInformatik · EnglischDiandrei

Alle Decks: Informatik

Lerne diese Decks in der App

Kostenlos auf iPhone, Android, Mac und im Web. Füge jedes Deck mit einem Tipp zu deinem Konto hinzu.

Laden im App StoreJetzt bei Google Play
Alle 30 Karten kostenlos lernen