UNIT: Dictionaries
2 Marks / Short Questions
1. What is a dictionary in Python?
2. How is a dictionary different from a list?
3. What are keys and values in a dictionary?
4. Write the syntax for creating a dictionary.
5. What is dictionary aliasing?
6. What is shallow copying of a dictionary?
7. Name any four dictionary methods.
8. What is the difference between get() and indexing
([])?
5 Marks Questions
1. Explain various dictionary operations with
examples.
2. Discuss dictionary methods such as keys(), values(),
items(), get(), and update().
3. Explain aliasing and copying in dictionaries with
suitable examples.
4. Write a Python program to count the frequency of
words using a dictionary.
5. Explain how elements are inserted, modified, and
deleted in a dictionary.
10 Marks Questions
1. Explain dictionary operations and dictionary
methods with suitable examples.
2. Discuss aliasing and copying in dictionaries.
Compare assignment, shallow copy, and deep copy.
3. Write a Python program to store student details
using dictionaries and perform dictionary
operations.
UNIT: NumPy
2 Marks / Short Questions
1. What is NumPy?
2. What is an ndarray?
3. Define the shape of an array.
4. What is array slicing?
5. What is masking in NumPy?
6. What is broadcasting?
7. What is dtype in NumPy?
8. How do you create a NumPy array?
5 Marks Questions
1. Explain the concept of shape in NumPy arrays.
2. Discuss slicing operations in NumPy with examples.
3. Explain masking and its applications.
4. What is broadcasting? Illustrate with examples.
5. Explain various data types supported by NumPy.
10 Marks Questions
1. Explain NumPy arrays and discuss shape, slicing,
masking, broadcasting, and dtype with examples.
2. Write a Python program demonstrating array
creation, slicing, and broadcasting.
3. Explain the advantages of NumPy over Python lists
with suitable examples.
4. Discuss masking and broadcasting techniques in
detail with examples.
Programs
1. Create a NumPy array and display its shape.
2. Demonstrate slicing on a 2-D array.
3. Use masking to display elements greater than a
given value.
4. Demonstrate broadcasting by adding a scalar to an
array.
5. Create arrays with different dtypes and display their
types.
UNIT: Files
2 Marks / Short Questions
1. What is a file in Python?
2. What are the different file modes?
3. What is the purpose of the open() function?
4. What is a binary file?
5. What is a directory?
6. How do you read a file line by line?
7. What is the difference between text files and binary
files?
8. What is meant by fetching data from the web?
5 Marks Questions
1. Explain how to write data into a file.
2. Explain reading a file line-at-a-time with an
example.
3. Discuss how to convert a file into a list of lines.
4. Explain reading an entire file at once.
5. Explain working with binary files.
6. Discuss directory operations in Python.
7. Explain fetching data from the web using Python.
10 Marks Questions
1. Explain file handling in Python with suitable
examples.
2. Discuss writing and reading files in Python using
different approaches.
3. Explain text files and binary files with examples.
4. Explain directory handling and file operations in
Python.
5. Describe the process of fetching data from the web
using Python.
Programs
1. Write a program to create a file and write user input
into it.
2. Write a program to read a file line by line.
3. Write a program to read all lines of a file into a list.
4. Write a program to count words, lines, and
characters in a file.
5. Write a program to copy contents from one file to
another.
Most Important 10-Mark Questions for VTU
1. Explain dictionary operations, methods, aliasing,
and copying with examples.
2. Explain NumPy concepts: shape, slicing, masking,
broadcasting, and dtype.
3. Explain reading and writing files using different
methods.
4. Explain working with binary files and directories.
5. Write programs demonstrating NumPy slicing,
masking, and broadcasting.
6. Explain fetching data from the web using Python.
7. Compare dictionary aliasing and copying with
examples.
8. Explain NumPy arrays and their advantages over
Python lists.