Chapter 2 Fundamentals of
Programming Lambert
What does a programmer do during the analysis phase of software development? -
answer Writes the algorithms for solving a problem.
-A programmer will write an algorithm for solving the problem during the analysis phase
of software development and analyses the efficiency of the algorithm while solving the
problem.
What must a programmer use to test a program - answer All possible sets of inputs.
-The performance of the program should be good in any condition and for all sets of
inputs, not only on a limited number of sets. For this reason, during testing, the program
is stress tested with many input sets.
What must you use to create a multi-line string? - answer A single pair of three
consecutive double quotation marks
-In python, a multi-line string starts and ends with three consecutive double quotation
marks.
For example, the following code in python (3),
print(""" HelloWorld""")
will produce output:
Hello World
What is used to begin an end-of-line comment? - answer# symbol
-In python, end of line ( or single line) comments are started using #
These lines are not interpreted by the interpreter.
For example:
print("1")
#print("2")
print("3")
will output:
1
3
Write an import statement that imports just the functions sqrt and log from the math
module. - answerfrom math import sqrt, from math import log
What is the purpose of the dir function and the help function? - answerThe purpose of
the dir() function is that it returns a list of symbols and names for any given object. The
purpose of the help() function is to display modules, functions, classes and keyword
documentation.
Programming Lambert
What does a programmer do during the analysis phase of software development? -
answer Writes the algorithms for solving a problem.
-A programmer will write an algorithm for solving the problem during the analysis phase
of software development and analyses the efficiency of the algorithm while solving the
problem.
What must a programmer use to test a program - answer All possible sets of inputs.
-The performance of the program should be good in any condition and for all sets of
inputs, not only on a limited number of sets. For this reason, during testing, the program
is stress tested with many input sets.
What must you use to create a multi-line string? - answer A single pair of three
consecutive double quotation marks
-In python, a multi-line string starts and ends with three consecutive double quotation
marks.
For example, the following code in python (3),
print(""" HelloWorld""")
will produce output:
Hello World
What is used to begin an end-of-line comment? - answer# symbol
-In python, end of line ( or single line) comments are started using #
These lines are not interpreted by the interpreter.
For example:
print("1")
#print("2")
print("3")
will output:
1
3
Write an import statement that imports just the functions sqrt and log from the math
module. - answerfrom math import sqrt, from math import log
What is the purpose of the dir function and the help function? - answerThe purpose of
the dir() function is that it returns a list of symbols and names for any given object. The
purpose of the help() function is to display modules, functions, classes and keyword
documentation.