0% found this document useful (0 votes)
34 views7 pages

BCE 2203 Computing For Civil Engineering Test I-Marking Guide

The document discusses coursework for Year II Semester II of the Bachelor of Civil Engineering program. It provides a marking guide for the Computing for Civil Engineering Test I, outlining questions and point values on topics like computer programming, data types, algorithms, and flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views7 pages

BCE 2203 Computing For Civil Engineering Test I-Marking Guide

The document discusses coursework for Year II Semester II of the Bachelor of Civil Engineering program. It provides a marking guide for the Computing for Civil Engineering Test I, outlining questions and point values on topics like computer programming, data types, algorithms, and flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

FACULTY OF ENGINEERING, TECHNOLOGY, APPLIED DESIGN AND FINEART

DEPARTMENT OF CIVIL ENGINEERING

BACHELORS OF CIVIL ENGINEERING

YEAR II SEMESTER II COURSEWORK

ACADEMIC YEAR 2021/22


BCE 2203: COMPUTING FOR CIVIL ENGINEERING TEST I – MARKING GUIDE

Date Sun: 20th November, 2022 Time: 09:30 AM – 11:00 AM

Reference Action/Calculation Full marks Remarks


Question One (25 Marks)
Qn 1 a i. A computer program refers to the sequence or a set of
instructions written using a computer programming language to
perform a particular task using a computer.
Examples include; MS Word, Adobe Photoshop, Autodesk
AutoCAD.

ii. A programming language is a formal language used to write


instructions for the computer.
It lets the programmer express data processing in a symbolic
manner without regard to machine-specific details.
Programming languages can be used to create programs that 01 mark
control the behavior of a machine and/or to express algorithms 04 marks for each
precisely. well
Examples include; python, C++, JavaScript, Java explained

iii. A compiler is a computer program that translates the high


level language into machine or low level language.
When a programmer writes a code in a high level language the
compiler scans the entire program first and then translates it
into machine code which will be executed by the computer
processor and the corresponding tasks will be performed.
Examples are; Microsoft visual C++ compiler, GNU Compiler
collection (GCC)

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.

Qn 1 b An interpreter is a computer program that converts each


statement of a high level programming language into a machine 01 mark
code or low level programing language.
The following are the differences between a compiler and an
interpreter

Basis Compiler Interpreter


Input Takes in the entire Takes in line by line of
program for analysis code for analysis

Output Gives intermediate Does not generate any Award full


code forms or object intermediate code forms marks for
code any 5
points
Execution Execution of the Execution of the program
program happens only takes place after every
after the entire program line is evaluated hence
is compiled error is raised line by line
if any 05 marks
Run time Compiled program Interpreted program
consumes less time and consumes more time and
runs faster runs slower

Generation Compilation gives an Interpretation does not


output program that give any output program
runs independently and thus
from the source file

Programing C, C++, C#, Java are Python, PHP, PERL,


languages compiler based Ruby are interpreter
programming based programming
languages languages

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 d Data types define which kind of data is stored in variables and


also defines memory storage of data.
Or
A data type refers to a classification of data which tells the
compiler or interpreter how the programmer intends to use the
data.
03 marks
Variables refer to symbols showing data values that are
subject to variations. Variables are used to store data value
and these values can be change during the execution of the
program.

Identifiers refer to the descriptive names given to entities such


as variables, functions, arrays, lists, etc., to make the code
more meaningful and understandable.

Qn 1 e Integer (int). Integers are whole numbers which do not have any
fractional part and decimal point i.e. 3, 5, 200.

Character (char): Character data type is used to represent


letters and symbols. They are defined in C++ by the keyword
char. There is no character data type in python.

String. A string is a collection of one or more characters put in 02 marks


either single quotes or double quotes. In C++ strings must be for each
wrapped around double quotes. well
explained
Floating point (float). Floating point are integers which contain point
fractional part. They are defined in C++ and python by the
keyword float. 08 marks

Boolean. Boolean is a data type with one of the two built in


values, true or false (True or False for Python). They are defined
in C++ by the keyword bool.

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

Question Two (25 Marks)

Qn 2 a An algorithm is defined as a sequence of instructions that


describe a method for solving a problem. It is an effective
procedure to solve a problem in a finite number of steps.
Algorithm lays down the step by step instructions to be executed
in order to solve a problem by the computer in order to achieve,
efficiency, abstraction and reusability of a computer program.
The practical goal of algorithm analysis is to predict the
performance of different algorithms in order to guide program
design decisions.

A flowchart is a schematic representation of an algorithm or a


stepwise process, showing the steps as boxes of various kinds,
and their order by connecting these with arrows. Flowcharts
are used in designing or documenting a process or program.
A flow chart, or flow diagram, is a graphical representation of
a process or system that details the sequencing of steps
required to create output. 06 marks
Flowcharts are used in order to achieve, better logic
communication of a program, effective program analysis,
proper program documentation and maintenance.

Pseudocode refers to a programming analysis tool, which is


commonly used for planning the program logic. It includes a set
of instructions that mimic programming language instructions
although written in normal English and cannot be understood
by the computer.

Qn 2 b i. Properties of a programming algorithm are;


• Input. A good algorithm should aim at taking in either
zero or more items as input
• Output. A good algorithm should produce at least one
or more items as an output
• Definiteness. Instructions used in an algorithm should 05 marks
be clear and unambiguous.
• Finiteness. A good algorithm should terminate after a
number of finite steps
• Effectiveness. Every step in an algorithm should be
simple and easy to understand

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")

#variables Award full


length_units = "m" marks for a
program
#getting user data input and changing it to floating points to running
allow use of decimal numbers without
udl = float(input(f"{'':3}Enter the Udl w on the beam: ")) errors
beam_length = float(input(f"{'':3}Enter beam length L: "))
distance_from_support = float(input(f"{'':3}Enter length x 06 marks
from the support: "))

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}")

return shear # returning the shear force

#bending moment function


def moment(load_w, length_l, distance_x):
#moment formula
bending=(load_w/2)*((length_l*distance_x) -
(distance_x**2))

#check if the value of x is greater than L or is negative


if distance_x > length_l or distance_x < 0:
bending = f"{'':3}Invalid distance x from the beam
support"
else:
bending = (f"{'':3}Bending moment: {bending:.2f}
{moment_units}")
return bending #returning the bending moment

Page 6 of 7
#store return values from functions into variables
shearForce = shear_force(udl, beam_length,
distance_from_support)

bendingMoment = moment(udl, beam_length,


distance_from_support)

#print the data


print(f"\n{'':3}=============================
====Data============================\n")
print(f"{'':3}Load: {udl:.2f} {udl_units}\n{'':3}Length:
{beam_length:.2f} {length_units}\n{'':3}Distance x:
{distance_from_support:.2f} {length_units}")

# print the results


print(f"\n{'':3}=============================
====Results============================\n
")
print(f"{shearForce}")
print(f"{bendingMoment}")

Page 7 of 7

You might also like