0% found this document useful (0 votes)
0 views21 pages

Computer Programming

The document contains a series of questions and statements related to Python programming, covering topics such as data structures, programming concepts, libraries, and best practices. It includes multiple-choice questions, true/false statements, and inquiries about the software development life cycle and ethical programming. The content is designed to assess knowledge and understanding of Python and its applications.

Uploaded by

pg-ecackah1122
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)
0 views21 pages

Computer Programming

The document contains a series of questions and statements related to Python programming, covering topics such as data structures, programming concepts, libraries, and best practices. It includes multiple-choice questions, true/false statements, and inquiries about the software development life cycle and ethical programming. The content is designed to assess knowledge and understanding of Python and its applications.

Uploaded by

pg-ecackah1122
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/ 21

1

What distinguishes a dictionary from a list in Python?

a) Dictionaries store data in key-value pairs

b) Lists are unordered collections

c) Dictionaries are mutable sequences

d) Lists can contain only unique elements

Ethics in programming ensures responsible development and use of technology.

True

False

Which library is commonly used for creating GUI applications in Python?

a) Tkinter

b) NumPy

c) Matplotlib

d) Pandas

Who created the Python programming language?

a) Guido van Rossum

b) James Gosling

c) Bjarne Stroustrup

d) Dennis Ritchie

What is one of the main reasons Python is considered a general-purpose programming


language?

a) It can only be used for data analysis

b) It is only suitable for web development

c) It can be used for any programming task


d) It is only used in scientific computing

Advanced data structures in Python include heaps, graphs, and linked lists, which provide
more efficient ways to handle complex data.

True

False

What type of error occurs when a program encounters a problem that causes it to terminate
unexpectedly?

a) Syntax error

b) Runtime error

c) Logic error

d) Indentation error

Which module in Python provides built-in mathematical functions?

a) math

b) statistics

c) random

d) numpy

The software development life cycle includes stages such as requirements gathering, design,
implementation, testing, and maintenance.

True

False

10

What is the primary purpose of object-oriented programming (OOP) in Python?

a) To develop large-scale software and GUIs effectively

b) To create simple scripts without any structure

c) To avoid using functions in programming


d) To replace all procedural programming techniques

11

What is the main function of an if statement in Python?

a) To repeat a block of code multiple times

b) To control the execution of code based on a condition

c) To define a function

d) To create a new variable

12

What are the two numeric types in Python?

a) Integers and Floats

b) Strings and Lists

c) Tuples and Dictionaries

d) Characters and Arrays

13

Using virtual environments helps manage project dependencies effectively.

True

False

14

Git is a version control system that helps manage changes to code and allows for
collaboration among developers.

True

False

15

How many marks are allocated for quizzes, assignments, group work, and presentations in
the continuous assessment?

a) 10 marks

b) 20 marks

c) 30 marks

d) 40 marks
16

What is the primary purpose of using libraries in Python?

a) To extend Python's functionality

b) To write code in other programming languages

c) To create web applications

d) To manage databases

17

What is the primary purpose of loops in Python?

a) To execute statements repeatedly

b) To define functions

c) To create classes

d) To handle exceptions

18

What is Matplotlib primarily used for in Python programming?

a) Creating static, animated, and interactive visualizations

b) Writing data processing scripts

c) Developing machine learning models

d) Building web applications

19

Best practices in Python programming are optional and can be ignored without affecting
code quality.

True

False

20

What function is used to write data to a file in Python?

a) open()

b) write()

c) read()
d) close()

21

What is one of the main objectives of the Python programming course?

a) To learn the syntax of Python only

b) To use Python to solve engineering problems

c) To memorize programming languages

d) To create games using Python

22

Collaboration tools help programmers work together effectively.

True

False

23

Effective project management ensures successful delivery of software projects.

True

False

24

What is Matplotlib primarily used for in Python?

a) Creating static, animated, and interactive visualizations

b) Writing and executing Python scripts

c) Managing Python packages and dependencies

d) Performing mathematical computations

25

What is a common debugging technique used in Python to understand the flow of a


program?

a) Using print statements

b) Ignoring error messages

c) Rewriting the entire code

d) Running the program without any checks


26

What is a consequence of being late to class according to the Code of Ethics for Students?

a) Students will receive a warning

b) Students will not be allowed to enter the class

c) Students will lose marks in attendance

d) Students will be required to submit a late assignment

27

Testing in Python is only necessary for large projects and not for smaller ones.

True

False

28

What is a key characteristic of recursion in programming?

a) It involves a function calling itself

b) It requires multiple functions to work together

c) It is always more efficient than loops

d) It can only be used in mathematical calculations

29

How do you write a comment in Python?

a) Using // for single-line comments

b) Using # for single-line comments

c) Using /* */ for multi-line comments

d) Using ''' for multi-line comments

30

What does it mean for Python to be an interpreted language?

a) Python code is executed one statement at a time.

b) Python code is compiled into machine code before execution.

c) Python code requires a separate compiler to run.

d) Python code cannot be debugged easily.


31

Why is indentation important in Python?

a) It helps in organizing code visually

b) It determines the block of code

c) It is only a matter of style

d) It allows for faster execution

32

Documentation is unnecessary if the code is clear and easy to understand.

True

False

33

What keyword is used to define a function in Python?

a) def

b) function

c) define

d) method

34

Programming careers are limited to software development.

True

False

35

What is a key advantage of using Numpy for numerical computations in Python?

a) It provides a simple way to create strings.

b) It offers a high-performance multidimensional array object.

c) It is faster than all other programming languages.

d) It automatically converts Python lists to arrays.


36

What is the primary purpose of inheritance in Python?

a) To allow a class to inherit properties and methods from another class

b) To enable methods to take on different forms based on the object calling them

c) To create a new class without any properties or methods

d) To restrict access to certain methods in a class

37

The + and - operators can be both unary and binary in Python.

True

False

38

What is the result of the expression True and False in Python?

a) True

b) False

c) None

d) Error

39

Best practices in software development ensure code quality and maintainability.

True

False

40

What is the purpose of calculating the mean in statistics?

a) To find the middle value of a dataset

b) To determine the most frequently occurring value

c) To summarize the average of a dataset

d) To measure the spread of data values


41

Command-line applications provide a simple way for users to interact with software through
text commands.

True

False

42

In Python, a program can decide which statements to execute based on a condition using
selection statements such as if and if-else.

True

False

43

Tuples in Python are mutable sequences of items.

True

False

44

What module in Python provides additional mathematical functions beyond the built-in
ones?

a) numpy

b) math

c) statistics

d) random

45

Docker allows you to create, deploy, and run applications in containers, ensuring consistency
across environments.

True

False

46

Data visualization is the discipline of trying to understand data by placing it in a visual


context.
True

False

47

In object-oriented programming, a class defines properties and behaviors for objects, while
objects are instances of classes with unique identities.

True

False

48

What is one of the reasons Python is considered a versatile programming language?

a) It is only used for web development

b) It has a simple syntax and extensive libraries

c) It was created in 2000

d) It is only used in academic settings

49

A recursive function solves a problem by calling itself to handle smaller instances of that
problem.

True

False

50

What is one way to customize a plot created with Matplotlib?

a) Adding a title to the plot

b) Changing the color of the plot

c) Adjusting the size of the plot

d) Adding a grid to the plot

51

What is the primary responsibility of developers in creating ethical software?

a) To prioritize technical efficiency over user privacy

b) To ensure algorithms are fair and unbiased

c) To maximize profit from software sales


d) To follow the latest programming trends

52

Flask is a micro web framework for Python that makes it easy to create web applications and
APIs.

True

False

53

What is the primary role of a class in object-oriented programming?

a) To define the properties and behaviors for objects

b) To perform mathematical operations

c) To store data in a linear format

d) To execute a sequence of statements

54

What is the primary data structure used by Pandas for handling structured data?

a) Series

b) Matrix

c) DataFrame

d) Array

55

Matplotlib can create various types of plots, including line, bar, histogram, and scatter plots.

True

False

56

What is a common mistake that can occur when using loops in Python?

a) Using incorrect indentation

b) Not defining variables

c) Forgetting to import libraries

d) Using the wrong data type


57

What are the two numeric types in Python?

a) Strings and Booleans

b) Integers and Floats

c) Lists and Tuples

d) Dictionaries and Sets

58

A while loop in Python executes statements repeatedly as long as a specified condition


remains true.

True

False

59

What is the primary purpose of an API?

a) To allow different software applications to communicate with each other

b) To store data in a database

c) To create graphical user interfaces

d) To perform mathematical calculations

60

What is a common technique for handling missing values in a dataset during data cleaning?

a) Removing the entire row with missing values

b) Replacing missing values with a placeholder like 'N/A'

c) Filling missing values with the mean or median of the column

d) Ignoring missing values and proceeding with analysis

61

Machine learning involves using algorithms to analyze data and make predictions or
decisions based on that data.

True

False
62

Scope determines the visibility of variables in different parts of a Python program.

True

False

63

What are the stages of the software development life cycle?

a) Design, Implementation, Testing, Deployment, Maintenance

b) Requirements, Design, Implementation, Testing, Deployment, Maintenance

c) Analysis, Design, Implementation, Maintenance, Review

d) Requirements, Analysis, Testing, Deployment, Maintenance

64

Inheritance allows a new class to inherit properties and methods from an existing class in
object-oriented programming.

True

False

65

Matplotlib is primarily used for creating static, animated, and interactive visualizations in
Python.

True

False

66

􀋯Hide

􀋯􀋯

What is a key benefit of using functions in Python programming?

a) They make the code longer and more complex

b) They allow for code reusability and organization

c) They eliminate the need for variables

d) They can only be used for complex tasks


67

Recursion is a method of solving a problem where the solution depends on solutions to


smaller instances of the same problem.

True

False

68

What is one of the key advantages of using Numpy arrays over standard Python lists?

a) Numpy arrays can store data in multiple dimensions

b) Numpy arrays are always faster for all operations

c) Numpy arrays can only store integers

d) Numpy arrays consume more memory than lists

69

Agile methodologies focus on iterative development and collaboration among teams.

True

False

70

Polymorphism in programming allows methods to operate on different types of objects,


enabling flexibility in code implementation.

True

False

71

Debugging is the process of identifying and removing errors from computer hardware or
software.

True

False

72

What is the main difference between the assignment operator (=) and the equality operator
(==) in Python?
a) The assignment operator assigns a value to a variable, while the equality operator checks
if two values are equal.

b) The assignment operator checks if two values are equal, while the equality operator
assigns a value to a variable.

c) The assignment operator is used for mathematical calculations, while the equality
operator is used for logical operations.

d) The assignment operator can only be used with numbers, while the equality operator can
be used with any data type.

73

Lists in Python can store multiple items in a single variable.

True

False

74

What is a key difference between mutable and immutable data structures in Python?

a) Mutable structures can be changed after creation

b) Immutable structures can be changed after creation

c) Both structures can be changed after creation

d) Neither structure can be changed after creation

75

Software architecture defines the structure and organization of a software system.

True

False

76

Python has only one numeric type, which is integers.

True

False

77

What is the role of algorithms in programming?

a) To store data permanently


b) To define the syntax of a programming language

c) To describe the steps needed to solve a problem

d) To execute code without errors

78

A function in Python is defined as a collection of statements that performs a specific task.

True

False

79

Why are virtual environments important for Python projects?

a) They allow you to run Python code faster.

b) They help manage dependencies for different projects separately.

c) They are required for all Python programs.

d) They provide a graphical interface for Python programming.

80

A syntax error in Python occurs due to mistakes in code construction, such as mistyping a
statement.

True

False

81

Cybersecurity involves protecting systems and data from threats and vulnerabilities.

True

False

82

What is a primary advantage of using Seaborn for data visualization?

a) It provides a low-level interface for customization

b) It simplifies the creation of complex visualizations

c) It is exclusively for 3D plotting

d) It requires extensive coding for basic plots


83

NumPy is the core library for scientific computing in Python and provides high-performance
multidimensional array objects.

True

False

84

What is a common debugging technique used to understand the flow of a program?

a) Using print statements

b) Ignoring error messages

c) Writing more code

d) Refactoring the entire program

85

What is a key characteristic of recursion in programming?

a) It requires a loop to function properly

b) It solves problems by calling itself with smaller instances

c) It is only used for mathematical calculations

d) It always leads to infinite loops

86

In Python, the try block is used to handle exceptions and prevent the program from crashing
when an error occurs.

True

False

87

In Python, files can be opened, read, written, and closed using built-in functions for file
handling.

True

False
88

Why is testing important in software development?

a) It ensures the reliability and correctness of software

b) It eliminates the need for documentation

c) It reduces the cost of software development

d) It is only necessary for large projects

89

What is the primary purpose of inheritance in object-oriented programming?

a) To allow a class to inherit attributes and methods from another class

b) To create objects that can perform multiple functions

c) To ensure code is executed in a specific order

d) To define functions that can be reused across programs

90

What is the main purpose of machine learning?

a) To enable computers to learn from data

b) To create static software applications

c) To manually program every decision

d) To optimize hardware performance

91

The Python math module provides built-in mathematical functions like sqrt(), sin(), and
cos().

True

False

92

What library is commonly used for creating GUI applications in Python?

a) Tkinter

b) NumPy

c) Matplotlib
d) Pandas

93

What is the purpose of using a context manager when handling files in Python?

a) To open files in read-only mode

b) To automatically close files after their block of code is executed

c) To create new files without writing data

d) To handle exceptions during file operations

94

Libraries in Python provide pre-written code for common tasks, enhancing functionality and
productivity.

True

False

95

Data science involves using statistical methods and algorithms to analyze and interpret
complex data.

True

False

96

In Python, incorrect indentation can lead to syntax errors and runtime issues.

True

False

97

What is one way to customize plots in Matplotlib?

a) Using subplots to create multiple plots in one figure

b) Changing the data type of the plot

c) Setting the color of the plot only

d) Using only default styles without modification


98

What is the purpose of using modules in Python?

a) To organize code into separate files for better maintainability

b) To create graphical user interfaces

c) To handle exceptions and errors in the code

d) To improve the performance of the code

99

Python was created by Guido van Rossum in 1990 and is named after Monty Python's Flying
Circus.

True

False

100

What is the purpose of the title in a Matplotlib plot?

a) To provide a label for the y-axis

b) To indicate the data being plotted

c) To describe the overall content of the plot

d) To define the color of the plot

101

What type of error occurs when the program has incorrect syntax and cannot be executed?

a) Runtime error

b) Logic error

c) Syntax error

d) Type error

102

Cloud computing allows for scalable and flexible access to computing resources over the
internet.

True

False
103

How can you extend the functionality of a Python program?

a) By importing libraries and modules

b) By writing all code from scratch

c) By using only built-in functions

d) By avoiding external libraries

104

Pandas is a powerful library for data manipulation and analysis in Python.

True

False

THE ATITSO FACTOR

You might also like