- Home
- Studylists
Class - 12 CBSE Computer Science Important Output Questions 2025
Class - 12 CBSE Computer Science Important Output Questions 2025
Python String Manipulation
What will be the output produced by following code fragments?
x = "hello world" print (x[:2], x[:-2], x[-2:]) print (x[6], x[2:4]) print (x[2:-3], x[-4:-2])
View Answer31 Likes
Python List Manipulation
Predict the output of the following code snippet ?
a = [1, 2, 3, 4, 5] print(a[3:0:-1])
View Answer2 Likes
Python List Manipulation
Predict the output of the following code snippet?
arr = [1, 2, 3, 4, 5, 6] for i in range(1, 6): arr[i - 1] = arr[i] for i in range(0, 6): print(arr[i], end = "")
View Answer11 Likes
Python List Manipulation
Predict the output of the following code snippet ?
Numbers = [9, 18, 27, 36] for Num in Numbers : for N in range(1, Num % 8) : print(N, "#", end=" ") print( )
View Answer12 Likes
Python Tuples
What would be the output of following code if
ntpl = ("Hello", "Nita", "How's", "life?") (a, b, c, d) = ntpl print ("a is:", a) print ("b is:", b) print ("c is:", c) print ("d is:", d) ntpl = (a, b, c, d) print(ntpl[0][0]+ntpl[1][1], ntpl[1])
View Answer9 Likes
Python Tuples
Predict the output.
tuple_a = 'a', 'b' tuple_b = ('a', 'b') print (tuple_a == tuple_b)
View Answer12 Likes
Python Dictionaries
What will be the output of the following code snippet ?
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"} id1 = id(rec) del rec rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"} id2 = id(rec) print(id1 == id2)
- True
- False
- 1
- Exception
View Answer4 Likes
Python Dictionaries
Write the output of the code given below :
my_dict = {"name" : "Aman", "age" : 26} my_dict['age'] = 27 my_dict['address'] = "Delhi" print(my_dict.items())
View Answer4 Likes
Python Dictionaries
What will be the output of the following code snippet ?
my_dict = {} my_dict[(1,2,4)] = 8 my_dict[(4,2,1)] = 10 my_dict[(1,2)] = 12 sum = 0 for k in my_dict: sum += my_dict[k] print(sum) print(my_dict)
View Answer7 Likes
Python String Manipulation
What will be the output of the following code snippet ?
message = "World Peace" print(message[-2::-2])
View Answer14 Likes