NEW
Font size
WorksheetsCOMP 121 - Midterm Exam
Total questions: 60
Worksheet time: 30mins
What is one major advantage of using simulation software in engineering?
It eliminates the need for engineers
It allows testing of designs under various conditions without physical prototypes
It increases production costs
It slows down the design process
Which of the following is NOT an example of automation in engineering?
CNC machines in manufacturing
Programmable Logic Controllers (PLCs) in industrial automation
Traffic light control systems
Manual sketching of design blueprints
In mechanical engineering, which software is used for stress testing and simulation?
Revit
SolidWorks
AutoCAD
Visual Studio
How do computers improve precision in engineering?
By reducing the need for engineers
By automating repetitive tasks without supervision
By enhancing accuracy in designs and measurements
By increasing the cost of prototyping
What is the role of software in a computer system?
It physically connects different parts of the computer
It provides instructions that tell the hardware what to do
It replaces the need for human interaction
It only refers to operating systems like Windows
Which of the following is an example of system software?
Microsoft Word
Google Chrome
Windows Operating System
Adobe Photoshop
Which of the following statements about hardware is TRUE?
Hardware consists of programs that run on a computer.
Hardware is a set of instructions that control the computer’s operation.
Hardware includes physical components like the CPU, RAM, and storage devices.
Hardware cannot function without an internet connection.
What is the main difference between RAM and a storage device (HDD/SSD)?
RAM is used for long-term data storage, while storage devices provide quick access to active programs.
RAM is volatile and loses data when power is off, while storage devices retain data permanently.
RAM is a type of input device, while storage devices are output devices.
RAM is faster but stores more data than storage devices.
Which of the following is an example of an input device?
Monitor
Printer
Keyboard
Speaker
In the IPOS cycle, which component is responsible for transforming input data into meaningful results?
Input
Process
Output
Storage
What is the role of the Control Unit (CU) in the CPU?
To perform calculations
To store data temporarily
To direct operations within the CPU
To increase the clock speed of the processor
Which type of software includes tools like IDEs, compilers, and debuggers?
Application Software
System Software
Utility Software
Programming Tools
What is a key difference between open-source and proprietary software?
Open-source software is paid, while proprietary software is free.
Proprietary software’s source code is not accessible, while open-source software allows modification and redistribution.
Open-source software is usually more secure than proprietary software.
Proprietary software is always cloud-based, while open-source software is not.
Which of the following languages was introduced in the 1950s as one of the first high-level languages?
Python
Java
COBOL
C++
What is the primary function of a programming language?
To perform hardware repairs
To allow communication between the computer and the user
To provide a set of instructions that a computer can execute
To generate electricity for the computer
Which of the following is a feature of a programming language?
It is designed to read natural language
It allows humans to interact directly with hardware
It defines syntax and semantics for writing machine-readable instructions
It is only used for web development
What is the main characteristic of Machine Language in the First Generation of programming?
Written in human-readable code
Written in binary code (1s and 0s)
Uses symbols for instructions
Written using a programming language like Python
How does Assembly Language compare to Machine Language?
Assembly language is more difficult to learn than machine language.
Assembly language uses symbolic names, while machine language uses binary code.
Assembly language is slower and more error-prone than machine language.
Assembly language was not compatible with early computers.
What was the primary goal behind the invention of the BASIC programming language in 1964?
To create a language that only professionals could use.
To provide a simple programming language for students.
To develop a language for complex scientific calculations.
To replace all existing programming languages.
Who introduced the PASCAL programming language in 1971?
John Kemeny
Thomas Kurtz
Niklaus Wirth
Dennis Ritchie
What is Ada Lovelace best known for in the field of computing?
Designing the first modern computer
Writing the first algorithm intended for a machine
Inventing the first computer programming language
Developing the first digital calculator
Which of the following is a typical use of Assembly Language?
Developing web applications.
Writing device drivers and embedded system software.
Writing desktop software like word processors.
Implementing high-level algorithms for machine learning.
Which of the following is a key advantage of high-level languages over low-level languages?
High-level languages run faster than low-level languages.
High-level languages are easier for humans to read and write, abstracting away hardware complexities.
High-level languages interact directly with the hardware for better performance.
High-level languages are only used for embedded systems.
What is the primary difference between compiled and interpreted languages?
Compiled languages run slower than interpreted languages.
Interpreted languages create an executable file while compiled languages do not.
Compiled languages are translated into machine code once, while interpreted languages are translated line-by-line at runtime.
Interpreted languages are only used for web development.
What is a key feature of Object-Oriented Programming (OOP)?
Programs are written as a sequence of instructions to be executed.
Code is divided into procedures or routines for repetitive tasks.
Programs are built around objects that contain both data and methods.
Programs are written in a linear sequence, with no focus on modularity.
Who is the creator of Python?
Dennis Ritchie
Brian Kernighan
Guido van Rossum
James Gosling
What does IDE stand for?
Integrated Data Editor
Integrated Development Environment
Internet Development Environment
Internal Development Engine
What is a variable in programming?
A fixed value that cannot change during execution
A symbolic name referring to data stored in memory
A function used to perform calculations
A value written directly into the code
What is a literal in programming?
A symbolic name that refers to data
A value that can change during program execution
A fixed value directly written into the code
A special kind of variable
Which of the following is an example of a numeric data type?
"Hello, World!"
123
True
[1, 2, 3]
What is the main difference between integer and floating-point data types?
Integers have decimal points, and floats do not
Integers are used for text, and floats are used for numbers
Integers are whole numbers, and floats have decimal points
Integers can only store positive values, while floats can store both negative and positive
Which of the following is the correct way to declare a variable in Python?
int x = 10
x: int = 10
x = 10
variable x = 10
What will the following code produce?
x = 10
y = 3.14
name = "Alice"
print(x, y, name)
10 3.14 Alice
10 3 Alice
3.14 Alice 10
Error: invalid syntax
Which of the following is a valid Python identifier?
1st_name
total-cost
student_name
@total_cost
Which rule does the following identifier violate?
1st_name = "Alice"
It contains a space
It starts with a number
It has special characters
It is not case-sensitive
What is the issue with this variable name?
total-cost = 250
It starts with a number
It contains a hyphen (special character)
It contains spaces
It is case-sensitive
What is the output of the following code?
x = 5
y = 10
sum_value = x * y
print("Sum:", sum_value)
Sum: 5
Sum: 10
Sum: 15
Sum: 50
What will happen if you try to perform the following operation in Python?
a = 5
b = "hello"
c = a + b
It will cause a SyntaxError.
It will concatenate the values and output "5hello".
It will raise a TypeError because you cannot add an integer to a string.
It will print "hello5".
What will be the output of the following code?
x = 42
print(x)
x = "Hello, World!"
print(x)
42, Hello, World!
42, 42
Hello, World!, Hello, World!
Syntax error
What will be the output of the following code?
number = 10
print(number)
number = "Ten"
print(number)
10, 10
10, Ten
Ten, 10
Syntax error
Which of the following statements is true regarding dynamic typing in Python?
Python does not allow variables to hold different data types during the program execution.
Variables are statically typed, and their data types cannot be changed.
A variable in Python can change its data type during execution based on the value assigned to it.
Variables in Python must be declared with their data types before use.
Which of the following is a valid variable name in Python?
2ndName
_my_variable
total-amount
my variable
Which of the following is an example of using snake case for variable names in Python?
firstName
first_name
First_Name
Firstname
What is the correct convention for naming constants in Python?
first_name
MAX_SPEED
MaxSpeed
max_speed
Which of the following is a valid variable name in Python?
if
while
my_variable
True
What is the result of the following expression in Python?
result = (3 + 2) * 2 * * 3 / 4
print(result)
10.0
16.0
8.0
7.5
Which of the following is a key characteristic of spaghetti code?
Clear and organized flow
Easy to debug and maintain
Lack of structure and convoluted execution paths
Well-commented and modular design
What is a key characteristic of an unstructured (spaghetti) program?
Clear and well-organized flow
Modular design with clear function separation
Disorganized jumps and poorly managed control structures
Proper error handling and debugging capabilities
What is a key feature of a structured program?
Disorganized control flow with arbitrary jumps
Clear logical flow using sequence, selection, and loops
Lack of modularity and code reusability
Complex error handling mechanisms
Which of the following is a key characteristic of a sequence structure?
It can skip over some instructions.
It always executes instructions in a random order.
It executes instructions in the order they are written.
It requires conditional statements.
What is the primary purpose of a selection structure in programming?
To execute instructions in a fixed order.
To allow the program to make decisions based on conditions.
To repeat instructions multiple times.
To organize code into functions.
What is the primary purpose of an iteration structure in programming?
To execute code only once.
To repeat a block of code based on a specified condition.
To create a decision point based on conditions.
To execute code in a fixed order.
Determine the output of the following python code below:
x = 5
while x > 0:
print(x)
x -= 1
5 4 3 2 1
4 3 2 1 0
5 4 3 2
5 4 3 2 1 0
Determine the output of the following python code below:
x = 5
y = 10
z = x * y + 3
print(z)
50
53
48
55
Determine the output of the following python code below:
a = 10
b = 5
c = a % b
print(c)
0
5
10
15
What will be the output of the above program?
6 5
7 5
8 4
6 4
What will be the output of the above program?
10 25 25
10 25 20
10 30 25
10 15 25
What will be the output of the above program?
4 6
5 6
3 6
4 5
What will be the output of the above program?
14 10
14 13
12 10
14 15
What will be the output of the above program?
10 20
30 20
30 25
10 25
