Podcast
Questions and Answers
Which operator is NOT considered an arithmetic operator in Python?
Which operator is NOT considered an arithmetic operator in Python?
Logical operators can be used to combine multiple Boolean expressions.
Logical operators can be used to combine multiple Boolean expressions.
True
What are the basic data types available in Python?
What are the basic data types available in Python?
int, float, str, list, tuple, dict, set
In Python, a ________ is used to store values for later use.
In Python, a ________ is used to store values for later use.
Signup and view all the answers
Match the following operators with their respective descriptions:
Match the following operators with their respective descriptions:
Signup and view all the answers
Which function would you use to split a string into a list of words?
Which function would you use to split a string into a list of words?
Signup and view all the answers
Strings in Python are mutable, meaning they can be changed after creation.
Strings in Python are mutable, meaning they can be changed after creation.
Signup and view all the answers
How would you check if a year is a leap year in Python?
How would you check if a year is a leap year in Python?
Signup and view all the answers
Which method of the os module would you use to change the current working directory?
Which method of the os module would you use to change the current working directory?
Signup and view all the answers
The os.path module provides methods to manipulate file and directory paths.
The os.path module provides methods to manipulate file and directory paths.
Signup and view all the answers
What is the primary use of the isfile() method in the os.path module?
What is the primary use of the isfile() method in the os.path module?
Signup and view all the answers
The _______ method in os module can be used to remove an empty directory.
The _______ method in os module can be used to remove an empty directory.
Signup and view all the answers
Match the following os module methods with their descriptions:
Match the following os module methods with their descriptions:
Signup and view all the answers
Which of the following formats is characterized by its use of commas to separate values?
Which of the following formats is characterized by its use of commas to separate values?
Signup and view all the answers
Files can be deleted using the walk() method of the os module.
Files can be deleted using the walk() method of the os module.
Signup and view all the answers
Describe the diamond problem in Python programming.
Describe the diamond problem in Python programming.
Signup and view all the answers
What does the Python program need to count in a given string?
What does the Python program need to count in a given string?
Signup and view all the answers
Python can add two matrices together.
Python can add two matrices together.
Signup and view all the answers
What is the purpose of the zip() function in Python?
What is the purpose of the zip() function in Python?
Signup and view all the answers
The function used to calculate the __________ of a list of numbers is called variance.
The function used to calculate the __________ of a list of numbers is called variance.
Signup and view all the answers
Match the following Python functions with their purposes:
Match the following Python functions with their purposes:
Signup and view all the answers
Which of these is NOT a characteristic of tuples?
Which of these is NOT a characteristic of tuples?
Signup and view all the answers
The average of all numbers is referred to as the mode.
The average of all numbers is referred to as the mode.
Signup and view all the answers
Explain what is meant by 'Pythonic code.'?
Explain what is meant by 'Pythonic code.'?
Signup and view all the answers
Study Notes
Python Programming Exam Questions
- Question 1: Describe arithmetic, assignment, comparison, logical, and bitwise operators in detail with examples.
- Question 1: Explain identifiers, keywords, statements, expressions, and variables in Python, providing examples.
- Question 1: Explain basic data types in Python with examples.
- Question 2a: Write a Python program to reverse a number, find the sum of its digits, and prompt the user for input.
- Question 2b: Write a Python program to check if a given year is a leap year.
- Question 2c: Write a Python program to find the greatest common divisor (GCD) of two positive numbers.
- Question 3a: Write a Python code to determine if a given string is a palindrome using slicing.
-
Question 3b: Explain the
join()
andsplit()
string methods with examples, and describe immutability of strings with examples. - Question 3c: Write a Python program to calculate the total number of vowels, consonants, and blanks in a string.
- Question 4a: Write a Python program to add two matrices, including finding the transpose of the result.
- Question 4b: Write a Python program that takes five integers, calculates the sum of negative numbers, positive numbers, their average, and numbers above average.
- Question 4c: Write a Python program to calculate the mean, variance, and standard deviation of a list of numbers.
- Question 5a: Discuss the relationship between tuples and lists, and between tuples and dictionaries in detail.
- Question 5b: Write a Python program to swap two numbers without using a temporary variable.
- Question 5c: Write a program that accepts a sentence and determines the count of digits, uppercase letters, and lowercase letters.
-
Question 6a: Write a Pythonic program to sort names alphabetically without using the
sort()
function. -
Question 6b: Discuss the
zip()
function with an example. -
Question 6c: Show how to use the
intersection()
,union()
,subset()
,difference()
,update()
, anddiscard()
Set methods with examples. -
Question 7a: Discuss special characters
\d
,\w
,\b
,{m, n}
,\
, and?
in detail. -
Question 7b: Write a Python program to delete all files and subdirectories from an
Extinct_Animals
directory -
Question 7c: Describe the Python
os
andos.path
modules, including methodschdir()
,rmdir()
,walk()
,listdir()
,getcwd()
,isfile()
,abspath()
,relpath()
,dirname()
,splitext()
, andgetmtime()
. - Question 8a: Describe the characteristics of the CSV format.
- Question 8b: Write a Python program to write data to a CSV file (given example data including Category, Winner, Film, and Year).
- Question 9a: Write a Python program, using polymorphism, to calculate the area and perimeter of different shapes.
- Question 9b: Illustrate the “diamond problem” in Python programming with an example.
- Question 10a: Write a Python program to demonstrate the construction of Method Resolution Order.
-
Question 10b: Create two rectangle objects, write a Python program to check if the area of the first rectangle is greater than the second using the overloading
>
operator.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers various aspects of Python programming, including operators, data types, and basic programming tasks. It is designed to test knowledge through both theoretical questions and practical coding exercises. Perfect for students looking to evaluate their understanding of Python basics and coding skills.