0% found this document useful (0 votes)
5 views2 pages

Assignment 1 Python Programming

The document is a Python programming assignment consisting of questions that cover various programming concepts such as algorithms, pseudocode, error handling, variable scope, and type casting. It also includes multiple choice questions related to these topics, testing knowledge on pseudocode purpose, algorithm characteristics, keywords in Python, and loop functionalities. Additionally, there is a practical task to write a program that determines if a number is prime, along with an explanation of the algorithm used.

Uploaded by

karan.shrestha
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)
5 views2 pages

Assignment 1 Python Programming

The document is a Python programming assignment consisting of questions that cover various programming concepts such as algorithms, pseudocode, error handling, variable scope, and type casting. It also includes multiple choice questions related to these topics, testing knowledge on pseudocode purpose, algorithm characteristics, keywords in Python, and loop functionalities. Additionally, there is a practical task to write a program that determines if a number is prime, along with an explanation of the algorithm used.

Uploaded by

karan.shrestha
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/ 2

Python Programming Assignment 1

Answer the following Questions


1. Difference between algorithm and pseudocode with example. Explain the purpose of using
pseudocode in programming?
2. Describe how would you approach solving a programming problem when you encounter
an error in your code.
3. Explain the importance of breaking down a complex problem into smaller, more
manageable tasks.
4. Explain the significance of keywords in python programming
5. Discuss the difference between “is” and “==” operator in python
6. Explain the concept of type casting in Python and its significance
7. Explain the concept of scope in programming and how it affects the visibility and lifetime
of variables. Provide examples of local and global variables in Python and discuss their
scope
8. Write a Python program that prompts the user to enter a number and then prints whether
the number is prime or not. Include code implementation, explanation of the algorithm
used, and examples of usage solution
Multiple Choice Questions
a. What is the purpose of pseudocode?
a. To execute a program
b. To debug a program
c. To represent an algorithm in a language independent manner
d. To compile a program
b. Which of the following is not the characteristic of a good algorithm?
a. Unambiguous
b. Efficient
c. Language-specific
d. Finiteness
c. What is the first step in the problem-solving process?
a. Gathering requirements
b. Identifying the problem
c. Testing the solutions
d. Implementing the solution
d. What is the purpose of a keyword in Python?
a. To define a variable
b. To perform mathematical operations
c. To control the flow of a program
d. To represent data
e. What is the primary purpose of a while loop?
a. To execute a block of code for specified number of times
b. To iterate over elements of a collection
c. To execute a block of code repeatedly as long as condition is true
d. To skip over certain iterations based on a condition
f. What is the purpose of the pass keyword in Python?
a. To create an empty block of code
b. To define a variable with no value
c. To skip the current iteration in a loop
d. To terminate a loop or function
g. What is the output of the following pseudocode?
Start
num = 10
while num > 0:
num = num - 1
Output num
Stop

a. 0
b. 1
c. 10
d. None

You might also like