ENGR 102 EXAM 2 EXAM WITH CORRECT
ACTUAL QUESTIONS AND CORRECTLY WELL
DEFINED ANSWERS LATEST ALREADY GRADED
A+
Save
Terms in this set (37)
1. List 5 good coding practices that # Q1
have been mentioned in this course. # always comment your code
# keep your code simple
# test your code often, work through it in groups
# be consistent with your code
# use good identifying variables
# write as few of lines as possible
2. In the following dictionary, # Q2
identify the keys and values. Write mydict = {'Apple' : 3, 'Pear' : 5, 'Banana' : 2}
the command to add the items mydict['Orange'] = 1
'Orange' and 1 to the dictionary. print(mydict.items()) # prints items as list
What does the command print(mydict) # *** whats diff ??? ***
print(mydict.items()) output to the # cannot do this, a dictionary does not have
console? mydict = {'Apple' : 3, 'Pear' append or add
: 5, 'Banana' : 2} # mydict.append("'Orange' : 1")
3. Explain how dictionaries are # Q3
different from lists, and how lists are # dictionaries are a table of key values while a list
different from tuples. # is an ordered collection of items
# lists are mutable, tuples are not
, 4. Identify and explain 3 ways # Q4
strings are similar to lists # are similar bc both are used to store data and
are a collection of items
5. List all of the data types we have # Q5
seen in this course and provide an # integers : 9 : immutable
example of each. Identify which # floating-point : 2.9 : immutable
ones are mutable and which are # tuples/ strings : "" : immutable
immutable. # lists/ dictionaries : [] {} : mutable
6. In your own words, explain the # Q6
difference between the top-down # Top down programming, in simple terms, is
and bottom-up design methods. dividing
Name at least one advantage and # and conquering a problem, Bottum-up
one disadvantage for each. programming is
# used when you're not sure where to start your
code
7. Describe the various components # Q7
of a hierarchy. How can we use one # A hierarchy is an organized structure where
in program design? items are
# ranked based on level of importance. As the
tree
# descends, the tasks become less important.
ACTUAL QUESTIONS AND CORRECTLY WELL
DEFINED ANSWERS LATEST ALREADY GRADED
A+
Save
Terms in this set (37)
1. List 5 good coding practices that # Q1
have been mentioned in this course. # always comment your code
# keep your code simple
# test your code often, work through it in groups
# be consistent with your code
# use good identifying variables
# write as few of lines as possible
2. In the following dictionary, # Q2
identify the keys and values. Write mydict = {'Apple' : 3, 'Pear' : 5, 'Banana' : 2}
the command to add the items mydict['Orange'] = 1
'Orange' and 1 to the dictionary. print(mydict.items()) # prints items as list
What does the command print(mydict) # *** whats diff ??? ***
print(mydict.items()) output to the # cannot do this, a dictionary does not have
console? mydict = {'Apple' : 3, 'Pear' append or add
: 5, 'Banana' : 2} # mydict.append("'Orange' : 1")
3. Explain how dictionaries are # Q3
different from lists, and how lists are # dictionaries are a table of key values while a list
different from tuples. # is an ordered collection of items
# lists are mutable, tuples are not
, 4. Identify and explain 3 ways # Q4
strings are similar to lists # are similar bc both are used to store data and
are a collection of items
5. List all of the data types we have # Q5
seen in this course and provide an # integers : 9 : immutable
example of each. Identify which # floating-point : 2.9 : immutable
ones are mutable and which are # tuples/ strings : "" : immutable
immutable. # lists/ dictionaries : [] {} : mutable
6. In your own words, explain the # Q6
difference between the top-down # Top down programming, in simple terms, is
and bottom-up design methods. dividing
Name at least one advantage and # and conquering a problem, Bottum-up
one disadvantage for each. programming is
# used when you're not sure where to start your
code
7. Describe the various components # Q7
of a hierarchy. How can we use one # A hierarchy is an organized structure where
in program design? items are
# ranked based on level of importance. As the
tree
# descends, the tasks become less important.