Python Midterm IS4010

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which is a valid dictionary entry? "A":42 "C"[42] "B",42 "D"(42)

"A":42

The correct extension for a Python source code file is .python py .ipynb .p

.py

Which operator can be used to compare two values? = == <> !

==

The creator of Python is known as Benevolent dictator for life Great and fearless leader King of Code Programmer Potentate

Benevolent dictator for life

CSV stands for Compressed Seperated Value Continuously Seperated Value Comma Seperated Visualization Comma Seperated Value

Comma Seperated Value

The 'inventor' of Python is Harlan Franks Bill Gates Pete Rose Guido van Rossum

Guido van Rossum

A Dictionary consists of Value/Value pairs Unique sublists Key/Value pairs Key/List pairs

Key/Value pairs

What is the upper limit on an integer variable? 2,147,483,647 2^32 There is no upper limit 2^(31-1)

There is no upper limit

Create a List with these delimiters [ ] ( ) { } None of these

[ ]

Given a List, beta, what is the syntax to extract the first 3 elements? beta[0:3] beta[3] beta[0:4] beta[0:-1]

beta[0:3]

A function definition begins with def func fun meh

def

What data structure consists of key/value pairs? list set dictionary tuple

dictionary

This data structure can have decimal places int float string date

float

To improve modularity in a project, use this construct function Ctry / except statement loop if / else statement

function

What data type can contain whole numbers and no decimal places? double float int None of these

int

Python is a(n) language compiled Assembly Foreign interpreted

interpreted

Dictionaries are accessed by key/value pair value index key

key

Given a list, alpha, then alpha[0:5] is list comprehension list slicing list addressing list exformation

list slicing

List Comprehension can be used to replace Libraries functions Dictionaries loops

loops

What is the primary unit of storage at GitHub.com ? molecule atom repo package

repo

A column in a DataFrame is also called a(n) None of these Series row database

series

Which data structure cannot contain duplicates? string list set tuple

set

Create a Dictionary with these delimiters { } ( ) [ ] # #

{ }

The comment delimiter is # /* .... */ /// @

#

The if statement ends with ( ) ; & :

:

A Dictionary can contain None of these Another Dictionary A CSV File A Pandas library

Another Dictionary

Which of these expressions defines a List? [1,2,3,'apple'] ['peach':123] {1,2,3,'peach'] {'plum':123}

[1,2,3,'apple']

Given a List, beta, what is the syntax to extract the last element? beta[+1] beta[-1] beta[last] None of these

beta[-1]

The import statement evaluates the interpreter path computes the file system brings in code from another module generates a possible solution

brings in code from another module

Python is case-sensitive

True

What is a possible value for a Boolean variable? 42 Maybe True None of these

True

Which method can be used to remove any whitespace from both the beginning and the end of a string? trim() c_trim() alltrim() all_trim()

trim()

What are the keywords for exception handling? try / except set / catch try / catch in / out

try / except

In this class, our IDE is Python 3.8 Eclipse Jupyter Notebook Visual Studio

Eclipse

Which is false? Keys in a Dictionary must be the same type Values in a dictionary can be lists All keys in a Dictionary can be the same type All are false

Keys in a Dictionary must be the same type

Python is named after The terrifying snake A World War II Aircraft Monty Python's Flying Circus A computer company

Monty Python's Flying Circus

Dictionaries can be Created without Keys Converted to a float Nested indexed by integers

Nested

The define keyword creates a(n) function procedure None of these module

None of these

How do you append one string to another? The combine function Not possible in Python The + operator The append function

Not possible in Python

Which of these is a thing? Python Fiddle Python Kitchen Table Python Snare Drum None of these

Python Fiddle

To run Python programs on your computer, you need a(n) Eclipse interpreter Python evaluator Eclipse evaluator Python interpreter

Python interpreter

A package contains Python projects Dictionaries None of these Python modules

Python modules

REPL stands for Read / Evaluate / Print /Loop Read / Evaluate / Process / List Read / Evaluate / Process / Repeat Read / Evaluate / Print/ Run

Read / Evaluate / Print /Loop

Loops are delimited by squiggly parentheses indenting curly brackets square brackets

indenting

Lists are accessed by None of these index key parentheses

index

In the interest of modularity, functions might be placed in seperate modules variables procedures loops

modules

What is a correct syntax to output "Hello World" in Python? print('Hello World') say('Hello World') p('Hello World') None of these

print('Hello World')

What is the correct syntax to output the type of a variable or object in Python? print(type[x]) print(typeof(x)) print(type(x)) print(Type(x))

print(type(x))


Kaugnay na mga set ng pag-aaral

Social Psychology Exam 3 Quiz Questions

View Set

AP Gov: Nominations and Campaigns (Unit 9)

View Set

Chapter 12: Leaders and leadership

View Set

Quiz 3 Chapter 3 "Business Ethics and Social Responsibility"

View Set

Chapter 3 Decision Structure (Review)

View Set