Questions

4 Marks Each

🎯

Test yourself on this topic

40 questions · timed · auto-graded

Question 54 Marks
Write the function Selection() to sort the list using Selection sort technique. The function will take the list as parameter.
View full question & answer
Question 64 Marks
Write the function Insertion() to sort the list using Insertion sort technique. The function will take the list as parameter.
View full question & answer
Question 74 Marks
Write the function Bubble() to sort the list using Bubble sort technique. The function will take the list as parameter.
View full question & answer
Question 84 Marks
Write definition of a Method AFIND(CITIES) to display all the city names from a list of CITIES, which are starting with alphabet A.

For example:If the list CITIES contains[“AHMEDABAD”,”CHENNAI”,”NEW DELHI”,”AMRITSAR”,”AGRA”]The following should get displayedAHEMDABADAMRITSARAGRA

View full question & answer
Question 94 Marks
Write a Python program to push all zeros to the end of a given list a. The order of the elements should not change.
View full question & answer
Question 104 Marks
Given a list of numbers (integers), write a function to return the second maximum and second minimum in this list.

View full question & answer
Question 114 Marks
Write a program which will store the student information in the form of a nested list as follows.

( i.e: student_name, roll_number, avg_marks )

View full question & answer
Question 154 Marks
WAF to take a list and inserting element as parameter and insert the new element at begining of the list.
View full question & answer
Question 174 Marks
Write a menu driven python program using function InQ(), DelQ() and DisplayQ() to implement the Queue. The program will store details of the flights
i.e Flight Number, Flight Name and Fare.
View full question & answer
Question 184 Marks
Write a menu driven python program using function InQ(), DelQ() and DisplayQ() to implement the Queue. The program will store the name of the books.
View full question & answer
Question 194 Marks
Write a menu driven python program using function Push (), Pop () and Display() to implement the stack. The program will store the Employee details i.e. Employee number, Employee name and Salary.
View full question & answer
Question 204 Marks
Write a menu driven python program using function Push(), Pop() and Display() to implement the stack. The program will store the name of the books.
View full question & answer
Question 214 Marks
Write AddClient(Client) and DeleteClient(Client) methods in python to add a new Client and delete a Client from a List of Client Names, considering them to act as insert and delete operations of the queue data structure.
View full question & answer
Question 224 Marks
Write Push(Book) and Pop(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP
operations of the data structure Stack.
View full question & answer
Question 234 Marks
Write a function Common () to accept lists as argument and return the list with common elements from both the lists.
View full question & answer
Question 244 Marks
Write a Function Filter() which will take a list as parameter and made the different lists Even[] and Odd[]. And then combine the two list and return the main list i.e. nested list.
View full question & answer
Question 254 Marks
Write the function Change(), to double the even elements and triple the odd elements present in a list. The function will take and list as parameter and also return the list.
View full question & answer
Question 264 Marks
Suppose we want to sort the following list of 7 elements in ascending order using

Selection sort:

Write the complete steps to sort the above along with each pass explanation.

Answer
Original array

Iteration 1 : Select the smallest element from unsorted array which is 3 and exchange 3 with the first element of the unsorted array i.e. exchange 3 with 8. After 1st iteration the element 3 is at its final position in the array.

Iteration 2: The second pass identifies 4 as the next smallest element and then exchange 4 with 5.

Iteration 3: The third pass identifies 5 as the next smallest element and then exchange 5 with 9.

Iteration 4: The third pass identifies 7 as the next smallest element and then exchange 7 with 8.

Iteration 5: The third pass identifies 8 as the next smallest element and then exchange 8 with 16

Iteration 6: The third pass identifies 9 as the next smallest element and then exchange 9 with 9 which makes no effect. Thus, the final list

View full question & answer
Question 274 Marks
p>Suppose we want to sort the following list of 7 elements in ascending order using insertion sort

Write the complete steps to sort the above along with each pass explanation.

Answer

Now, we get the sorted list is as follows:


The above procedure can also be shown as:


View full question & answer
Question 284 Marks
Suppose we want to sort the following list of 7 elements in ascending order using bubble sort:

Write the complete steps to sort the above along with each pass explanation.

Answer
The first pass of the comparisons goes as follows:

This completes one pass (round) of comparisons. This pass had 6 individual comparisons and had put the most significant element (9) of the list at the last position.

Now, the second pass of the comparisons starts. We shall not include the last element (9) in this pass, as it is the most significant element of the list and has been put at its required position by the previous pass. The second pass goes as follows:

This completes the second pass of comparisons. This pass had 5 individual comparisons and has put the most significant element (8), of the list of first six elements, at the last position. It gives the following list:

So, now we have one less element to sort.

It means that in each pass we are taking one element to its required position in the sorted list. This is repeated until all the elements have been sorted. Let us see the list after each pass:

We observe that each pass takes one element to its desired position, and hence, six elements are at their desired positions in six passes, and the seventh element is automatically left at its desired position. So, a list of seven elements are sorted in six passes.

In general, a list of N elements can be sorted in N-1 passes.

View full question & answer
Question 324 Marks
Write a menu driven program in python to implement the various method related to insertion and deletion in the list.
View full question & answer
Question 344 Marks

Write definition of a function MSEARCH(STATES) to display all the state names from a list of STATES, which are starting with alphabet M.
For example:
If the list STATES contains

The following should get displayed
MP
MH
MZ
View full question & answer
Question 364 Marks
Write definition of a function EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are odd on position.
View full question & answer
Question 374 Marks
Write a python program to create a list of numeric values and sort the list using Insertion Sort Technique.
View full question & answer
Question 384 Marks
Write a python program to create the list numeric values and sort the list using Bubble sort technique.
View full question & answer
Question 394 Marks
Write a python program using method to create the list of numeric values and search the number in the list using Binary Search Technique.
View full question & answer
Question 404 Marks
Write a python program using function to create the list of numeric values and search the number in the list using Linear Search Technique. The function will return –1 if element not found otherwise show the position.
View full question & answer
4 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip