wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

COMP 121 - Midterm Exam

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.

What is one major advantage of using simulation software in engineering?

a)

It eliminates the need for engineers

b)

It allows testing of designs under various conditions without physical prototypes

c)

It increases production costs

d)

It slows down the design process

2.

Which of the following is NOT an example of automation in engineering?

a)

CNC machines in manufacturing

b)

Programmable Logic Controllers (PLCs) in industrial automation

c)

Traffic light control systems

d)

Manual sketching of design blueprints

3.

In mechanical engineering, which software is used for stress testing and simulation?

a)

Revit

b)

SolidWorks

c)

AutoCAD

d)

Visual Studio

4.

How do computers improve precision in engineering?

a)

By reducing the need for engineers

b)

By automating repetitive tasks without supervision

c)

By enhancing accuracy in designs and measurements

d)

By increasing the cost of prototyping

5.

What is the role of software in a computer system?

a)

It physically connects different parts of the computer

b)

It provides instructions that tell the hardware what to do

c)

It replaces the need for human interaction

d)

It only refers to operating systems like Windows

6.

Which of the following is an example of system software?

a)

Microsoft Word

b)

Google Chrome

c)

Windows Operating System

d)

Adobe Photoshop

7.

Which of the following statements about hardware is TRUE?

a)

Hardware consists of programs that run on a computer.

b)

Hardware is a set of instructions that control the computer’s operation.

c)

Hardware includes physical components like the CPU, RAM, and storage devices.

d)

Hardware cannot function without an internet connection.

8.

What is the main difference between RAM and a storage device (HDD/SSD)?

a)

RAM is used for long-term data storage, while storage devices provide quick access to active programs.

b)

RAM is volatile and loses data when power is off, while storage devices retain data permanently.

c)

RAM is a type of input device, while storage devices are output devices.

d)

RAM is faster but stores more data than storage devices.

9.

Which of the following is an example of an input device?

a)

Monitor

b)

Printer

c)

Keyboard

d)

Speaker

10.

In the IPOS cycle, which component is responsible for transforming input data into meaningful results?

a)

Input

b)

Process

c)

Output

d)

Storage

11.

What is the role of the Control Unit (CU) in the CPU?

a)

To perform calculations

b)

To store data temporarily

c)

To direct operations within the CPU

d)

To increase the clock speed of the processor

12.

Which type of software includes tools like IDEs, compilers, and debuggers?

a)

Application Software

b)

System Software

c)

Utility Software

d)

Programming Tools

13.

What is a key difference between open-source and proprietary software?

a)

Open-source software is paid, while proprietary software is free.

b)

Proprietary software’s source code is not accessible, while open-source software allows modification and redistribution.

c)

Open-source software is usually more secure than proprietary software.

d)

Proprietary software is always cloud-based, while open-source software is not.

14.

Which of the following languages was introduced in the 1950s as one of the first high-level languages?

a)

Python

b)

Java

c)

COBOL

d)

C++

15.

What is the primary function of a programming language?

a)

To perform hardware repairs

b)

To allow communication between the computer and the user

c)

To provide a set of instructions that a computer can execute

d)

To generate electricity for the computer

16.

Which of the following is a feature of a programming language?

a)

It is designed to read natural language

b)

It allows humans to interact directly with hardware

c)

It defines syntax and semantics for writing machine-readable instructions

d)

It is only used for web development

17.

What is the main characteristic of Machine Language in the First Generation of programming?

a)

Written in human-readable code

b)

Written in binary code (1s and 0s)

c)

Uses symbols for instructions

d)

Written using a programming language like Python

18.

How does Assembly Language compare to Machine Language?

a)

Assembly language is more difficult to learn than machine language.

b)

Assembly language uses symbolic names, while machine language uses binary code.

c)

Assembly language is slower and more error-prone than machine language.

d)

Assembly language was not compatible with early computers.

19.

What was the primary goal behind the invention of the BASIC programming language in 1964?

a)

To create a language that only professionals could use.

b)

To provide a simple programming language for students.

c)

To develop a language for complex scientific calculations.

d)

To replace all existing programming languages.

20.

Who introduced the PASCAL programming language in 1971?

a)

John Kemeny

b)

Thomas Kurtz

c)

Niklaus Wirth

d)

Dennis Ritchie

21.

What is Ada Lovelace best known for in the field of computing?

a)

Designing the first modern computer

b)

Writing the first algorithm intended for a machine

c)

Inventing the first computer programming language

d)

Developing the first digital calculator

22.

Which of the following is a typical use of Assembly Language?

a)

Developing web applications.

b)

Writing device drivers and embedded system software.

c)
  • Writing desktop software like word processors.

d)

Implementing high-level algorithms for machine learning.

23.

Which of the following is a key advantage of high-level languages over low-level languages?

a)

High-level languages run faster than low-level languages.

b)

High-level languages are easier for humans to read and write, abstracting away hardware complexities.

c)

High-level languages interact directly with the hardware for better performance.

d)

High-level languages are only used for embedded systems.

24.

What is the primary difference between compiled and interpreted languages?

a)

Compiled languages run slower than interpreted languages.

b)

Interpreted languages create an executable file while compiled languages do not.

c)
  • Compiled languages are translated into machine code once, while interpreted languages are translated line-by-line at runtime.

d)

Interpreted languages are only used for web development.

25.

What is a key feature of Object-Oriented Programming (OOP)?

a)

Programs are written as a sequence of instructions to be executed.

b)

Code is divided into procedures or routines for repetitive tasks.

c)

Programs are built around objects that contain both data and methods.

d)

Programs are written in a linear sequence, with no focus on modularity.

26.

Who is the creator of Python?

a)

Dennis Ritchie

b)

Brian Kernighan

c)

Guido van Rossum

d)

James Gosling

27.

What does IDE stand for?

a)
  • Integrated Data Editor

b)

Integrated Development Environment

c)

Internet Development Environment

d)

Internal Development Engine

28.

What is a variable in programming?

a)

A fixed value that cannot change during execution

b)

A symbolic name referring to data stored in memory

c)
  • A function used to perform calculations

d)

A value written directly into the code

29.

What is a literal in programming?

a)

A symbolic name that refers to data

b)

A value that can change during program execution

c)

A fixed value directly written into the code

d)

A special kind of variable

30.

Which of the following is an example of a numeric data type?

a)

"Hello, World!"

b)

123

c)

True

d)

[1, 2, 3]

31.

What is the main difference between integer and floating-point data types?

a)

Integers have decimal points, and floats do not

b)

Integers are used for text, and floats are used for numbers

c)

Integers are whole numbers, and floats have decimal points

d)

Integers can only store positive values, while floats can store both negative and positive

32.

Which of the following is the correct way to declare a variable in Python?

a)

int x = 10

b)

x: int = 10

c)

x = 10

d)

variable x = 10

33.

What will the following code produce?
x = 10

y = 3.14

name = "Alice"

print(x, y, name)

a)

10 3.14 Alice

b)

10 3 Alice

c)

3.14 Alice 10

d)

Error: invalid syntax

34.

Which of the following is a valid Python identifier?

a)

1st_name

b)

total-cost

c)

student_name

d)

@total_cost

35.

Which rule does the following identifier violate?
1st_name = "Alice"

a)

It contains a space

b)

It starts with a number

c)

It has special characters

d)

It is not case-sensitive

36.

What is the issue with this variable name?
total-cost = 250

a)

It starts with a number

b)

It contains a hyphen (special character)

c)

It contains spaces

d)

It is case-sensitive

37.

What is the output of the following code?
x = 5

y = 10

sum_value = x * y

print("Sum:", sum_value)

a)

Sum: 5

b)

Sum: 10

c)

Sum: 15

d)

Sum: 50

38.

What will happen if you try to perform the following operation in Python?
a = 5

b = "hello"

c = a + b

a)

It will cause a SyntaxError.

b)

It will concatenate the values and output "5hello".

c)

It will raise a TypeError because you cannot add an integer to a string.

d)

It will print "hello5".

39.

What will be the output of the following code?
x = 42

print(x)

x = "Hello, World!"

print(x)

a)

42, Hello, World!

b)

42, 42

c)

Hello, World!, Hello, World!

d)

Syntax error

40.

What will be the output of the following code?

number = 10

print(number)

number = "Ten"

print(number)

a)

10, 10

b)

10, Ten

c)

Ten, 10

d)

Syntax error

41.

Which of the following statements is true regarding dynamic typing in Python?

a)

Python does not allow variables to hold different data types during the program execution.

b)

Variables are statically typed, and their data types cannot be changed.

c)

A variable in Python can change its data type during execution based on the value assigned to it.

d)

Variables in Python must be declared with their data types before use.

42.

Which of the following is a valid variable name in Python?

a)

2ndName

b)

_my_variable

c)

total-amount

d)

my variable

43.

Which of the following is an example of using snake case for variable names in Python?

a)

firstName

b)

first_name

c)

First_Name

d)

Firstname

44.

What is the correct convention for naming constants in Python?

a)

first_name

b)

MAX_SPEED

c)

MaxSpeed

d)

max_speed

45.

Which of the following is a valid variable name in Python?

a)

if

b)

while

c)

my_variable

d)

True

46.

What is the result of the following expression in Python?
result = (3 + 2) * 2 * * 3 / 4

print(result)

a)

10.0

b)

16.0

c)

8.0

d)

7.5

47.

Which of the following is a key characteristic of spaghetti code?

a)

Clear and organized flow

b)

Easy to debug and maintain

c)

Lack of structure and convoluted execution paths

d)

Well-commented and modular design

48.

What is a key characteristic of an unstructured (spaghetti) program?

a)

Clear and well-organized flow

b)

Modular design with clear function separation

c)

Disorganized jumps and poorly managed control structures

d)

Proper error handling and debugging capabilities

49.

What is a key feature of a structured program?

a)

Disorganized control flow with arbitrary jumps

b)

Clear logical flow using sequence, selection, and loops

c)

Lack of modularity and code reusability

d)

Complex error handling mechanisms

50.

Which of the following is a key characteristic of a sequence structure?

a)

It can skip over some instructions.

b)

It always executes instructions in a random order.

c)

It executes instructions in the order they are written.

d)

It requires conditional statements.

51.

What is the primary purpose of a selection structure in programming?

a)

To execute instructions in a fixed order.

b)

To allow the program to make decisions based on conditions.

c)

To repeat instructions multiple times.

d)

To organize code into functions.

52.

What is the primary purpose of an iteration structure in programming?

a)

To execute code only once.

b)

To repeat a block of code based on a specified condition.

c)
  • To create a decision point based on conditions.

d)

To execute code in a fixed order.

53.

Determine the output of the following python code below:
x = 5

while x > 0:

print(x)

x -= 1

a)

5 4 3 2 1

b)

4 3 2 1 0

c)

5 4 3 2

d)

5 4 3 2 1 0

54.

Determine the output of the following python code below:
x = 5

y = 10

z = x * y + 3

print(z)

a)

50

b)

53

c)

48

d)

55

55.

Determine the output of the following python code below:
a = 10

b = 5

c = a % b

print(c)

a)

0

b)

5

c)

10

d)

15

56.

What will be the output of the above program?

a)

6 5

b)

7 5

c)

8 4

d)

6 4

57.

What will be the output of the above program?

a)

10 25 25

b)

10 25 20

c)

10 30 25

d)

10 15 25

58.

What will be the output of the above program?

a)

4 6

b)

5 6

c)

3 6

d)

4 5

59.

What will be the output of the above program?

a)

14 10

b)

14 13

c)

12 10

d)

14 15

60.

What will be the output of the above program?

a)

10 20

b)

30 20

c)

30 25

d)

10 25