12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 10/09/2022
QB365 provides a detailed and simple solution for every Possible Creative Questions in Class 12Computer Science Subject - Lists, Tuples, Sets and Dictionary , English Medium. It will help Students to get more practice questions, Students can Practice these question papers in addition to score best marks.
Download Tamil Nadu 12th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
Differentiate between clear( ) and del Statement.
2.
How will you access adding, modifying and deleting elements from a dictionary.
3.
Explain in detail about tuples assignment.
4.
Explain in detail about reverse indexing with an example.
5.
Write a program that generate a set of prime numbers and another set of even numbers. Demonstrate the result of union. intersection. difference and symmetric difference operations.
6.
Write a program that has a list of positive and negative numbers. Create a new tuple that has only negative numbers from the list.
7.
Explain with an example how will you return multiple values in tuples.
8.
Write a program to create a list of numbers in the range 1 to 10. Then delete all the even numbers from the list and print the final list.
9.
Explain the detail about some important list function with an example.
(i) copy ()
(ii) count ()
(iii) index ()
(iv) reverse ()
10.
Explain remove (), pop () and clear () used in list with an example.
11.
Write a program to create a list of numbers in the range 1 to 10. Then delete all the odd numbers from the list and print the final list.
12.
How will you access elements of a list using for loop? Explain with an example.
13.
How will access all elements of a list? Write the execution table example.
1.
| Clear( ) | del statement |
| Used to delete all the elements in list, it deletes only the elements and retains the list | del statement deletes entire list |
Syntax for i) remove () ii) Pop() iii) clear ()
i) remove()
Syntax:
List.remove(element) #to delete a particular element
ii) pop():
Syntax:
List.pop(index of an element)
iii) clear()
Syntax:
list.clear()
Example:
> Mylist = [12, 89, 34, 'Kannan', 'Gowri sankar', 'Lenin')
>print(Mylist)
[12, 89, 34, 'Kannan', 'Gowri sankar', 'Lenin']
>> Mylist. remove(89)
>>>print (Mylist)
[12,34, 'Kannan; 'Gowri sankar', Lenin']
In the above example, Mylist has been created with three integer and three string elements, the print statement shows all the elements available in the list. In the statement >>> Mylist. remove (89), deletes the element 89 from the list and the print statement shows the remaining elements.
Example:
>>> Mylist.pop(1)
34
> print (Mylist)
[12, 'Kannan', 'Gowrisankar', 'Lenin']
pop() function is used to delete a particular element using its index value, as soon as the element is deleted, the pop( ) function shows the element which is deleted. pop() function is used to delele only one element from a list
Example:
> MyList. clear()
>>>print(MyList)
[ ]
clear( ) function removes only the elements and retains the list. To print the list which is already cleared, an empty square bracket is displayed.
2.
Accessing all elements from a dictionary is very similar as lists and Tuples. Simple print function is used to access all the elements. if we want to access a particular element, square brackets can be used along with key.
Example:
MyDict = {'Reg-no': '1221',
'Name': 'Tamilselvi',
'School': 'CGHSS',
'Address': 'Rotler St.,Chennai 112'}
print (MyDict)
print("Register Number:",MyDict ['Reg_No'])
print ("Name of the student:", MyDict ['Name'])
print("School", MyDict ['School'] )
print ("Address:", MyDict ['Address'] )
Output:
{'Reg-no': '1221', 'Name': 'Tamilselvi', 'School': 'CGHSS', 'Address': 'Rotler St.,Chennai 112'}
Register Number: 1221
Name of the student: Tamilselvi
School: CGHSS
Address: Rotler St.,Chennai 112.
In an existing dictionary, we can add more values by simply assigning the value along with key. The following syntax is used to understand adding more elements in a dictionary.
Syntax:
dictionary_name[key] = value/element
Example:
MyDict = {"Reg-no': '1221',
'Name': 'Tamilselvi',
'School': 'CGHSS',
'Address': 'Rotler St.Chennai 112'}
print (MyDict)
print("Register Number:", MyDict ['Reg_No'])
print ("Name of the student:", MyDict ['Name'])
MyDict ['Class'] = 'XII-A'
print ("Class",MyDict ['Class'])
print ("School",MyDict ['School'])
print ("Address:",MyDict ['Address'])
In Python dictionary, del keyword is used to delete a particular element. The clear( ) function is used to delete all the elements in a dictionary. To remove the dictionary, we can use del Keyword with dictionary name.
Syntax:
#To delete a particular element.
del dictionary_name [key]
#To delete all the elements
dictionary_name.clear ( )
#To delete an entire dictionary
del dictionary_name
Example:
Dict = {'Roll No' : 12001, 'SName': 'Meena', 'Mark1': 98, 'Mark2' : 86}
print ("Dictionary elements before deletion: \n", Dict)
del Dict ['Mark1]
print ("Dictionary elements after deletion of a element: \n", Dict)
Dict.clear()
print ("Dictionary after deletion of all elements: \n", Dict)
del Dict
print(Dict)
Output:
Dictionary elements before deletion:
{'Roll no': 12001, 'SName': 'Meena','Mark1': 98, 'Mark2': 86}
Dictionary elements after deletion of a element?
{' Roll No' : 12001,'SName':'Meena','Mark2': 86}
Dictionary after deletion of all elements: { }
Traceback (Most recent call last):
File "E:/Python/ Dict_Test-02.py",line 8, in < modules >
print (Dict)
Name Error: name 'Dict' is not defined.
3.
Tuple assignment is a powerful feature in Python. It allows a tuple variable on the left of the assignment operator to be assigned to the values on the right side of the assignment operator. Each value is assigned to its respective variable.
Example:
> > > (a, b, c) = (34, 90, 76)
> > > print(a, b, c)
34, 90, 76
#expression are evaluated before assignment.
>>>(x, y, z, p) = (2**2, 5/3 + 4, 15% 2, 34 > 65)
>>>print (x, y, z, p)
4.5666666666666671 False.
When we assign values to a tuple, ensure that the number of values on both sides of the assignment operator are same, otherwise, an error is generated by Python.
4.
Python enables reverse or negative index for the list elements. Thus, Python lists index in opposite order. The python sets -1 as the index value for the last element in list and -2 for the Preceding element and so on. This is called as Reverse Indexing.
Example:
Marks = [10, 23, 41, 75]
i = -1
while i >= -4:
print (Marks[i])
i = i + 1
Output:
75
41
23
10
The table show the working process of the above python coding.
| Iteration | i | while i >= -4 |
print (Marks[i]) | i = i + -1 |
| 1 | -1 | -1>= -4 True | Marks [-1] =75 | -1 + (-1) = -2 |
| 2 | -2 | -2 >= -4 True | Marks [-2]=41 | -2 + (-1) = -3 |
| 3 | -3 | -3 >= -4 True | Marks [-3]=23 | -3 + (-1) =-4 |
| 4 | -4 | -4 >= -4 True | Marks [-4]=10 | -4 + (-1) =-5 |
| 5 | -5 | -5 >= -4 False |
5.
Program:
even=set([x*2 for x in range(1, 11)])
primes=set()
for i in range(2,20):
j=2
f=0
while j<i/2:
if i%j==0:
f=1
j+=1
if f==0;
primes.add(i)
print("Even Numbers:", even)
print("Prime Numbers:", primes)
print("Union:", even.union(primes)
print('Intersection:", even.intersection(primes))
print("Difference: ", even.difference(primes))
print("Symmetric Difference:" , even.symmetric_difference(primes)
Output:
Even Numbers: {2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
Prime Numbers: {2, 3, 4,5, 7, 11, 13, 17, 19}
Union: {12, 3,4,5, 6,7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20}
Intersection: {2, 4}
Difference:{6, 8, 10, 12, 14, 16, 18, 20}
Symmetric Difference: {3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20}
6.
Program:
n = {5,-8, 6, 8, -4, 3, 1}
negative = 0
for i in n:
if {n < 0)
negative + = (i,)
print (negative)
7.
(i) A function can return only one value at a time, but Python returns more than one value from a function. Python groups multiple values and returns them together.
(ii) Example: Program to return the maximum as well as minimum values in a list
def Min_Max(n):
a = max(n)
b = min(n)
return (a, b)
Num = (12, 65, 84, 1, 18, 85, 99)
(Max_Num, Min_Num) = Min_Max(Num)
print("Maximum value = ", Max_Num)
print("Minimum value = ", Min_Num)
(iii) Output:
Maximum value = 99
Minimum value = 1
8.
Program:
Num = []
for x in range(1, 11):
Num.append(x)
print("The list of numbers from 1 to 10 = ",Num)
for index, i in enumerate(Num):
if(i%2==0):
del Num[index]
print("The list after deleting even numbers = ", Num)
Output:
The list of numbers from 1 to 10 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
The list after deleting even numbers =. [1, 3, 5, 7, 9]
9.
(i) copy ( ): Returns a copy of the list.
Syntax: List.copy( )
Example:
MyList=[12, 12,36]
x = MyList.copy()
print(x)
Output:
[12, 12, 36]
(ii) count () : Returns the number of similar elements present in the last.
Syntax: List.count(value)
Example:
MyList=[36 ,12 ,12]
x = MyList.count(12)
print(x)
Output:
(iii) index ( ): Returns the index value of the first recurring element.
Syntax: Listindex(element)
Example:
MyList=[36 ,12 ,12]
x = MyListindex(12)
print(x)
Output:
0
(iv) reverse ( ): Reverses the order of the element in the list.
Syntax: List.reverse( )
Example:
MyList=[36, 23, 12]
MyList.reverse()
print(MyList)
Output:
[12, 23, 36]
10.
remove ( ):
(i) The remove( ) function can also be used to delete one or more elements if the index value is not known.
(ii) Syntax:
List.remove(element) # to delete a particular element
(iii) Example:
> > > MyList= [12,89,34,'Kannan', 'Gowri sankar', 'Lenin']
> > > print(MyList)
[12, 89, 34, 'Karman', 'Gowrisankar', 'Lenin')
> > > MyList.remove(89)
> > > print(MyList)
[12, 34, 'Karman', 'Gowrisankar', 'Lenin']
pop ():
(i) pop() function can also be used to delete an element using the given index value. pope ) function deletes and returns the last element of a list if the index is not given.
(ii) pop() function is used to delete a particular element using its index value, as soon as the element is deleted.
(iii) The pop( ) function shows the element which is deleted. pope ) function is used to delete only one element from a list. Remember that, del statement deletes multiple elements.
(iv) Syntax: List.pop(index of an element)
(v) Example:
> > > MyList.pop(1)
34
> > > print(MyList)
[12, 'Kannan', 'Gowrisankar', 'Lenin')
clear ():
(i) The function clear( ) is used to delete all the elements in list, it deletes only the elements and retains the list
(ii) clear() function removes only the elements and retains the list. When you try to print the list which is already cleared, an empty square bracket is displayed without any elements, which means the list is empty.
(iii) Syntax:
List.clear( )
Example:
> > > MyList.clear( )
> > > print(MyList)
[ ]
11.
Program:
n=[]
for x in range (1, 11)
n = append (x)
for x, i in enumerate (n):
if(i %2! = 0):
del n [x]
print (n)
12.
(i) In Python, 'for loop' is used to access all the elements in a list one by one. This is just like the for keyword in other programming language such as C++.
(ii) Syntax:
for index_var in list:
print (index_var)
(iii) Here, dex_var represents the index value of each element in the list. Python reads this "for" statement like English: "For (every) element in (the list of) list and print (the name of the) list items"
(iv) Example:
Marks=[23,45, 67, 78,98]
for x in Marks:
print(x)
Output:
23
45
67
78
98
(v) In the above example, Marks list has 5 elements; each element is indexed from 0 to 4.
(vi) The Python reads the for loop and print statements like English: "For (every) element (represented as (x) in (the list of) Marks and print (the values of the) elements.
13.
(i) Loops are used to access all elements from a list. The initial value of the loop must be zero. Zero is the beginning index value of a list.
(ii) Example:
Marks = [10, 23, 41, 75]
i = 0
while i < 4:
print (Marks[i])
i = i + 1
Output:
10
23
41
75
(iii) In the above example, Marks list contains four integer elements i.e., 10, 23, 41, 75. Each element has an index value from 0. The index value of the elements are 0, 1, 2, 3 respectively.
(iv) Here, the while loop is used to read all the elements. The initial value of the loop is zero, and the test condition is < 4, as long as the test condition is true, the loop executes and prints the corresponding output
(iv) During the first iteration, the value of i is zero, where the condition is true. Now, the following statement print (Marks [i] gets executed and prints the value of Marks [0] element ie. 10.
(v) The next statement i = i + 1 increments the value of i from 0 to 1. Now, the flow of control shifts to the while statement for
(vi) checking the test condition. The process repeats to print the remaining elements of Marks list until the test condition of while loop becomes false. The following table shows that the execution of loop and the value to be print.
| Iteration | i | while i < 4 |
print (Marks[i]) | i = i + 1 |
| 1 | 0 | 0< 4 True | Marks [0] =10 | 0+1=1 |
| 2 | 1 | 1 < 4 True | Marks [1]=23 | 1+1=2 |
| 3 | 2 | 2 < 4 True | Marks [2]=41 | 2+1=3 |
| 4 | 3 | 3 < 4 True | Marks [3]=75 | 3+1=4 |
| 5 | 4 | 4 < 4 False |
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards