mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
a=0
while a < 7:
print (mylist[a],)
a += 2
Select one:
a.
now is the time
b.
now is the time for
c.
for score and seven years
d.
now four is score the and seven time years for
2 Match concepts with their definition!
Any one of the languages that people have designed for specific purposes, such as representing
mathematical ideas or computer programs; all programming languages are this kind of languages.
formal language
Any one of the languages that people speak that evolved naturally.
natural language
An error that does not occur until the program has started to execute but that prevents the program
from continuing.
runtime error
An error in a program that makes it do something other than what the programmer intended.
Semantics error
The meaning of a program.
semantics
The structure of a program.
syntax
An error in a program that makes it impossible to parse — and therefore impossible to interpret.
syntax error
One of the basic elements of the syntactic structure of a program, analogous to a word in a natural
language.
Token
3 Assume that d is a Python dictionary. What does the following Python code produce?
d.items()
,Select one:
a.
a histogram
b.
an inverted dictionary
c.
a list of tuples
d.
a lookup
e.
a reverse lookup
4 What output will the following python commands produce:
n = 10000
count = 0
while n:
count = count + 1
n = n // 10
print (count)
Select one:
a.
5
b.
0
c.
10000
d.
1000
5 Which one of the following Python expressions has the value 64?
Select one:
, a.
8^2
b.
8 ** 2
c.
8 +- 2
d.
8 += 2
e.
8 -+ 2
6 A variable that has a data type of "str" cannot be part of a compound data type
Select one:
True
False
7 What is the output of the following Python program?
mylist = [ [2,4,1], [1,2,3], [2,3,5] ]
total = 0
for sublist in mylist:
total += sum(sublist)
print(total)
Select one:
a.
14
b.
23
c.
0
d.