Advertisements
Chapters
![NCERT solutions for Computer Science [English] Class 11 chapter 10 - Tuples and Dictionaries NCERT solutions for Computer Science [English] Class 11 chapter 10 - Tuples and Dictionaries - Shaalaa.com](/images/computer-science-english-class-11_6:f845d20929ea4abdb3a8e0cf9f430d7f.jpg)
Advertisements
Solutions for Chapter 10: Tuples and Dictionaries
Below listed, you can find solutions for Chapter 10 of CBSE NCERT for Computer Science [English] Class 11.
NCERT solutions for Computer Science [English] Class 11 10 Tuples and Dictionaries Exercise [Pages 223 - 227]
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(tuple1.index(45))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(tuple1.count(45))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(tuple1 + tuple2)
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(len(tuple2))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(max(tuple1))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(min(tuple1))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
print(sum(tuple2))
Consider the following tuples, tuple1 and tuple2:
tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)
Find the output of the following statement:
p r i n t ( s o r t e d ( t u p l e 1 ) )
print(tuple1)
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.get("Bihar"))
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.keys())
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.values())
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.items())
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(len(stateCapital))
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print("Maharashtra" in stateCapital)
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.get("Assam"))
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
del stateCapital["Rajasthan"]
print(stateCapital)
“Lists and Tuples are ordered”. Explain.
With the help of an example show, how can you return more than one value from a function?
What advantages do tuples have over lists?
When to use a tuple or dictionary in Python. Give some examples of programming situations mentioning their usefulness.
Prove with the help of an example that the variable is rebuilt in case of immutable data types.
TypeError occurs while statement 2 is running. Give reason. How can it be corrected?
>>> tuple1 = (5) #statement 1
>>> len(tuple1) #statement 2
Programming Problems
Write a program to read the email IDs of n number of students and store them in a tuple. Create two new tuples, one to store only the usernames from the email IDs and the second to store domain names from the email IDs. Print all three tuples at the end of the program. [Hint: You may use the function split()]
Write a program to input the names of n students and store them in a tuple. Also, input a name from the user and find if this student is present in the tuple or not. We can accomplish these by:
writing a user-defined function
Write a program to input the names of n students and store them in a tuple. Also, input a name from the user and find if this student is present in the tuple or not. We can accomplish these by:
using the built-in function
Write a Python program to find the highest 2 values in a dictionary.
Write a Python program to create a dictionary from a string.
Note: Track the count of the letters from the string.
Sample string: 'w3resource'
Expected output : {'3': 1, 's': 1, 'r': 2, 'u': 1, 'w': 1, 'c': 1, 'e': 2, 'o': 1}
Write a program to input your friends’ names and Phone Numbers and store them in the dictionary as the key-value pair. Perform the following operations on the dictionary:
- Display the name and phone number of all your friends
- Add a new key-value pair in this dictionary and display the modified dictionary
- Delete a particular friend from the dictionary
- Modify the phone number of an existing friend
- Check if a friend is present in the dictionary or not
- Display the dictionary in sorted order of names
Case Study-Based Question
For the SMIS System given in Chapter 5, let us do the following: Write a program to take in the roll number, name, and percentage of marks for n students of Class X. Write user-defined functions to
- accept details of the n students (n is the number of students)
- search details of a particular student on the basis of roll number and display the result
- display the result of all the students
- find the topper among them
- find the subject toppers among them
(Hint: use Dictionary, where the key can be roll number and the value is an immutable data type containing the name and percentage).
Let’s peer review the case studies of others based on the parameters given under “DOCUMENTATION TIPS” at the end of Chapter 5 and provide feedback to them.
Case Study-Based Questions
A bank is a financial institution that is involved in borrowing and lending money. With advancements in technology, online banking, also known as internet banking allows customers of a bank to conduct a range of financial transactions through the bank’s website anytime, anywhere. As part of the initial investigation, you are suggested to
- collect a bank application form. After careful analysis of the form, identify the information required for opening a savings account. Also, enquire about the rate of interest offered for a saving account.
- The basic two operations performed on an account are Deposit and Withdrawal. Write a menu-driven program that accepts either of the two choices of Deposit and Withdrawal, then accepts an amount, performs the transaction, and accordingly displays the balance. Remember, every bank has a requirement for a minimum balance which needs to be taken care of during withdrawal operations. Enquire about the minimum balance required in your bank.
- Collect the interest rates for opening a fixed deposit in various slabs in a savings bank account. Remember, rates may be different for senior citizens.
Finally, write a menu-driven program having the following options (use functions and appropriate data types):
- Open a savings bank account
- Deposit money
- Withdraw money
- Take details, such as the amount and period for a Fixed Deposit, and display its maturity amount for a particular customer.
Participating in a quiz can be fun as it provides a competitive element. Some educational institutes use it as a tool to measure the knowledge level, abilities, and/or skills of their pupils either on a general level or in a specific field of study. Identify and analyze popular quiz shows and write a Python program to create a quiz that should also contain the following functionalities besides the one identified by you as a result of your analysis.
- Create an administrative user ID and password to categorically add, modify, or delete a question.
- Register the student before allowing her or him to play a quiz.
- Allow selection of category based on the subject area.
- Display questions as per the chosen category.
- Keep the score as the participant plays.
- Display the final score.
Our heritage monuments are our assets. They are a reflection of our rich and glorious past and an inspiration for our future. UNESCO has identified some Indian heritage sites as World heritage sites. Collect the following information about these sites:
- What is the name of the site?
- Where is it located?
District
State - When was it built?
- Who built it?
- Why was it built?
- The website link (if any).
Write a Python program to
- create an administrative user ID and password to add, modify or delete an entered heritage site in the list of sites.
- display the list of world heritage sites in India.
- search and display information about a world heritage site entered by the user.
- display the name(s) of world heritage site(s) on the basis of the state input by the user.
Every mode of transport utilizes a reservation system to ensure its smooth and efficient functioning. If you analyze you would find many things in common. You are required to identify any one mode of transportation and prepare a reservation system for it. For example, let us look at the Railway reservation system we talked about earlier. The complex task of designing a good railway reservation system is seen as designing the different components of the system and then making them work with each other efficiently. Possible subsystems are shown in Figure 1. Each of them may be modelled using functions.
Write a python code to automate the reservation needs of the identified mode of transport.
Railway reservation system
Solutions for 10: Tuples and Dictionaries
![NCERT solutions for Computer Science [English] Class 11 chapter 10 - Tuples and Dictionaries NCERT solutions for Computer Science [English] Class 11 chapter 10 - Tuples and Dictionaries - Shaalaa.com](/images/computer-science-english-class-11_6:f845d20929ea4abdb3a8e0cf9f430d7f.jpg)
NCERT solutions for Computer Science [English] Class 11 chapter 10 - Tuples and Dictionaries
Shaalaa.com has the CBSE Mathematics Computer Science [English] Class 11 CBSE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. NCERT solutions for Mathematics Computer Science [English] Class 11 CBSE 10 (Tuples and Dictionaries) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.
Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. NCERT textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.
Concepts covered in Computer Science [English] Class 11 chapter 10 Tuples and Dictionaries are Tuples, Tuple Operations, Tuple Methods and Built-in Functions, Tuple Assignment, Tuple Handling, Introduction to Dictionaries, Nested Tuples, Dictionaries Are Mutable, Dictionary Operations, Traversing a Dictionary, Dictionary Methods and Built-in Functions, Manipulating Dictionaries.
Using NCERT Computer Science [English] Class 11 solutions Tuples and Dictionaries exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in NCERT Solutions are essential questions that can be asked in the final exam. Maximum CBSE Computer Science [English] Class 11 students prefer NCERT Textbook Solutions to score more in exams.
Get the free view of Chapter 10, Tuples and Dictionaries Computer Science [English] Class 11 additional questions for Mathematics Computer Science [English] Class 11 CBSE, and you can use Shaalaa.com to keep it handy for your exam preparation.