Questions

4 Marks Each

🎯

Test yourself on this topic

21 questions · timed · auto-graded

Question 14 Marks
Write a script to create a list of 5 integers and then
(a) Create a copy of this list using copy() method
(b) Display both the lists
(c) Input an integer from the user and insert it in the first list at a specific location. The location should also be input from the user. Use insert() method for insertion.
(d) Display both the lists
View full question & answer
Question 24 Marks

Write a script to create two lists of 5 floating point values each and then
(a) Sort the first list using sort() method and display it without using any loop
(b) Reverse the second list using reverse() method and display it without using any loop
(c) Append the second list to the first list using extend() method
(d) Delete all the elements from the second list using clear() method
(e) Display the first list (after performing the above operations)
(f) Input an integer from the user and find how many times does it exist in the first list using count() method

View full question & answer
Question 34 Marks
Write a script to create a list of 10 random integers and display it. Then input an integer from the user and check whether it is present in the list. If it is present, find its location in the list using index() method and remove it from the list using pop() method. If the element is not present, then display an appropriate message.
View full question & answer
Question 44 Marks

Write a script to create a list of 10 random integers and display it. Then input an integer from the user and check whether it is present in the list (use in operator). If it is present in the list, then remove it from the list. If the element is present in the list multiple times then all its occurrences should be removed. (use remove() method). If the element is not present, then display an appropriate message.

View full question & answer
Question 54 Marks

Write a script to create a list of 10 random integers and display it. Then input an integer from the user and check whether it is present in the list (use in operator) and display an appropriate message.

View full question & answer
Question 64 Marks

Write a script to create a list of 10 random integers. Create two more lists –one containing even elements from the original list, and the other containing odd elements from the original list. Use append() method to create first list and concatenation operator to create the second. Then display all the three lists.

View full question & answer
Question 74 Marks
Write a script to create a list of 10 random integers. Using the concept of slicing, create two more lists –one containing first five elements of the original list, and the other containing last 5 elements of the original list. Then display all the three lists.
View full question & answer
Question 84 Marks
Write a script to create a list of 10 random floating point numbers and then
(a) Find the mean of the elements present in the list (without using sum() function)
(b) Find the mean of all those elements of the list which are more than the mean calculated in 5c (above part of the question)
View full question & answer
Question 94 Marks
Write a script to create a list of 10 random floating point numbers and then
(a) Display this list of numbers
(b) Find the largest and smallest numbers present in the list (without using max() and min() functions)
View full question & answer
Question 104 Marks

Write a script to create an empty list and then
(a) Input the names of 10 students and store them in the list using concatenation operator
(b) Display this list of names in reverse order

View full question & answer
Question 124 Marks

Write a program that reads a line and a substring. It should then display the number of the occurrence of the given substring in the line.

View full question & answer
Question 134 Marks

Write a program to create the list and ask user whether you want to delete an element if say yes then delete the element and print the new list else print the entered list.

View full question & answer
Question 144 Marks
Write a program to create the list and ask user whether you want to add new element if say yes then add the element and print the new list else print the entered list.
View full question & answer
Question 154 Marks

Write a program to sort the (name, age, height) tuples by ascending order where name is string, age and height are numbers. The tuples are input by the user. The sort criteria is:
1: Sort based on name;
2: Then sort based on age;
3: Then sort by score.
The priority is that name >age >score.
If the following tuples are given as input to the
program:
ram,19,20
Shyam,15,67
Raju,13,90
Rakesh,17,78
Then, the output of the program should be:
[('Raju', '13', '90'), ('Rakesh', '17', '78'), ('Shyam', '15', '67'), ('ram', '19', '20')]

View full question & answer
Question 164 Marks
Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.
Suppose the following input is supplied to the program:
Python Programming SKILLS
Then, the output should be:
UPPER CASE 8
LOWER CASE 15
View full question & answer
Question 174 Marks
Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
We are on first line.
second line
third line in python.
Then, the output should be:
WE ARE ON FIRST LINE.
SECOND LINE
THIRD LINE IN PYTHON.
View full question & answer
Question 184 Marks

Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.
Suppose the following input is supplied to the program:
hi,we,are,learning
Then, the output should be:
are,hi,learning,we

View full question & answer
Question 194 Marks

Write a program which accepts a sequence of commaseparated numbers from console and generate a list and a tuple which contains every number.

Suppose the following input is supplied to the program:
23,45,67,78,89
Then, the output should be:
['23', '45', '67', '78', '89']
('23', '45', '67', '78', '89')

View full question & answer
Question 204 Marks

Write a program to generate a dictionary that contains (i, i*i) such that it is an integral number between 1 and n (both included) and then the program should print the dictionary.
For the following input is supplied to the program:
Then, the output should be:
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}

View full question & answer
Question 214 Marks
Write a program which will find all such numbers which are divisible by 7 but are not multiples of 5, between 2000 and 2500 (both included). The numbers obtained should be printed in a comma-separated sequence on a single line.
View full question & answer
4 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip