BCE 2203 Computing For Civil Engineering Test I-Marking Guide
BCE 2203 Computing For Civil Engineering Test I-Marking Guide
Page 1 of 7
iv. A translator is a computer program that converts
instructions written in one programming language to another
without changing the initial logic in terms of computer
language.
Assemblers, interpreters and compilers are examples of
computer language translators.
Error and All errors are shown at Displays the errors from
error the end of the line to line. The program
execution compilation and the runs till the error is found
program cannot run and proceeds further on
until the error is resolving
resolved
Page 2 of 7
Qn 1 c Programming paradigm refers to the fundamental style/pattern
of programming in a certain programming language and
defines the organizing principle of the program. Basing on this,
programing languages are classified as; 02 mark
each point
i. Imperative programming languages. These are the ones in
which the programmer must specify the sequence of operations
that the program must perform to solve the problem. Examples
include; Java, PHP, Python, e.t.c.
04 marks
ii. Declarative programming languages. These are the ones in
which the programmer specifies the desired result and the
language is responsible for getting what it takes to achieve it.
Prolog, Lisp, and Haskell are examples of declarative
languages
Qn 1 e Integer (int). Integers are whole numbers which do not have any
fractional part and decimal point i.e. 3, 5, 200.
Page 3 of 7
Array types. An array is a collection of related data elements of
same type. They are derived data types from fundamental data
types such as integers and strings. For example, an array can
be used to represent a list of numbers (int) or a list of names
(char). In python arrays are presented inform of collections i.e.
lists, tuples, and dictionaries
Page 4 of 7
ii. The following steps are followed during program
development using an algorithm
• Statement of the problem. Problem to be solved should
be clearly explained with the required input/output, and
the objectives of the problem. This makes it easy to
understand the problem to be solved.
• Program analysis. This first technical step in program
development process helps a programmer or analyst to
understand the problem statement, objectives and tools
required for it. This helps him/her to find a better
solution to the problem stated.
• Program designing. After the software analysis
process, the multi-step design process (design phase)
begins. It mainly focuses on data, architecture, user
interfaces and program components. The main
importance of the design phase is to ensure a good
quality program
• Implementation. Based on the design process, this new
program/software design has to be implemented. This
step involves coding and building of a new
program/software using a chosen programming 08 marks 02 marks
language and software tools. Hence, clear and detailed for each
designing will result generating of effective code with well
less implementation time. explained
• Testing of the program. Program testing begins after point
the implementation stage is complete. It is aimed at
finding errors in the program, assuring program quality
and reviewing the analysis, design and implementation
stages.
• Documentation. This involves the compiling down the
descriptive information that explains the usage as well
as the functionality of the program/software. It
includes; documentation for programmers,
documentation for technical support, and
documentation for end users
• Program maintenance. This activity involves
amendments, measurements and tests in the existing
software. This is a stage where problems are fixed
depending on the users’ feedback and the program is
updated to make the system faster and better.
Page 5 of 7
Qn 2 c #program to calculate the bending moment and Shear force
of the simply supported beam
print("\n\t Simply supported beam's BM & SF calculator \n")
print("=================================
===============================\n")
print(f"{'':3}This program calculates the bending moment and
and the shear force \n{'':3}of a simply supported beam at any
distance x from the support \n")
udl_units = "kN/m"
moment_units = "kNm"
shear_units = "kN"
shear = 0
bending =0
#shear force function
def shear_force(load_w, length_l, distance_x):
#shear formula
shear = load_w*((length_l/2)-distance_x)
#check if the value of x is greater than L or is negative
if distance_x > length_l or distance_x < 0:
shear = f"{'':3}Invalid distance x from the beam support"
else:
shear = (f"{'':3}Shear force: {shear:.2f} {shear_units}")
Page 6 of 7
#store return values from functions into variables
shearForce = shear_force(udl, beam_length,
distance_from_support)
Page 7 of 7