CS 1064 Study Guide - Final Guide: For Loop

96 views1 pages
Function: a reusable chunk of code with inputs and outputs.
Variable: a name that can be associated with a value.
For loop: a control structure for performing actions on each element in a sequence.
If statement: a control structure for branching the execution of a program.
Dictionary: a data structure for mapping keys to values.
List: a data structure for storing elements in an ordered sequence.
Literal: specific instances of data written directly in source code.
Type: a categorization of values of similar kinds that determines what you can do
with the values.
File: a sequence of data stored in your computer’s long-term memory.
String: a type that represents textual data.
Module: a collection of functions, classes, and variables available to be imported.
Program: a sequence of coded instructions that manipulate data inside a computer.
Keywords: true false none and is or not pass def elif if else for while import return
ae = Pythograde = 100.0;[name] would return a list of strings;
[0][0] is a list; 10 == 10.0 returns true;  == . returns false; 1 < 5.0 returns
true; Alaska < Delawae is true;  +  ==  is false.
Assume this code is run first: uote = I like tutles;  i uote returns false; [1, 2,
3] < 5 is an error.
MCQS~print function can only print literal values: FALSE
~normally, statements are executed from top to bottom: TRUE
~expressions are always evaluated from left to right: FALSE
~strings are composed of only letters and numbers: FALSE
~iteration variable will take on each value of the list variable: TRUE
~like if / function call, for loop might cause execution not to follow seq. order: true
~list comprehensions cannot express everything that a for loop can: TRUE
~dictionaries will always have at least one key/one value: FALSE
~dictionaries can have duplicate keys: False (think about CS-2114 Lab 14’s
DuplicateEntryException)
~lists can be composed of dictionaries; dictionaries can be composed of lists: true
~unlike lists, tuples are immutable: TRUE
~tuples are composed of key/value pairs: FALSE
~while loops will always execute at least once: FALSE
~the open function consumes a String representing a path and returns a String of the
file’s contents: FALSE
~you must import the json module before using the load function: TRUE
~once a function returns a variable, the variable is avail.outside the function: false
~the following are valid Python variable names: 599_555_999, EarthQuake,
pag_counnt. _bad_news, _54_, BankAccount, _27_, stor_txt
~the input function returns a string, writes output to the console, retrieves input
from the user, consumes arguments
~which of the following can be involved in an expression: conditional ops, arithm.
ops, other exp., lit. values, variables NOT STATEMENTS
~How many values can either of these ops. Take? < 2; not 1; and 2; != 2
~the print function does which of the following: consumes arguments, writes
output to the console
~what does “pass” do? Absolutely nothing
~select each synonym for a Python dictionary: map, table
~good email titles: What is a TypeError and how do I get rid of it?, How do I
update a variable?
~which of the following types are sequences: list, dictionary, string, tuple, file
~which of the following have a body? Function definition, while loop, if
statement, for loop
CODE MCQs~
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Function: a reusable chunk of code with inputs and outputs. Variable: a name that can be associated with a value. For loop: a control structure for performing actions on each element in a sequence. If statement: a control structure for branching the execution of a program. Dictionary: a data structure for mapping keys to values. List: a data structure for storing elements in an ordered sequence. Literal: specific instances of data written directly in source code. Type: a categorization of values of similar kinds that determines what you can do with the values. File: a sequence of data stored in your computer"s long-term memory. Module: a collection of functions, classes, and variables available to be imported. Program: a sequence of coded instructions that manipulate data inside a computer. Keywords: true false none and is or not pass def elif if else for while import return (cid:374)a(cid:373)e = (cid:862)pytho(cid:374)(cid:863) grade = 100. 0;[name] would return a list of strings;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents