Questions

1 Marks Each

🎯

Test yourself on this topic

22 questions · timed · auto-graded

Question 21 Mark

Observe the following Python code very carefully and rewrite it after removing all syntactical errors with each
correction underlined.

View full question & answer
Question 51 Mark
Write the statement to extract the 5th character from the String “Together with ”which is stored in str.
View full question & answer
Question 141 Mark
What is String slice?
Answer
p>Slicing means extracting a part of the string by passing values between the square brackets []. For example:

View full question & answer
Question 151 Mark
Define object.
Answer
An entity is called an object. Objects are defined as variables of suitable classes. For example, if we define a class student to represent students of a school, then each student of the school will be defined as an object of the class student.
View full question & answer
Question 161 Mark
Define class.
Answer
A class is a collection of the objects/entities of the same type. A class represents the data members and the member functions collectively define entities of one type. For example, class of students, bunch of books, group of members etc can be defined to represent students, books, and members respectively.
View full question & answer
Question 171 Mark
Write the difference between List, Tuple and Dictionary.
Answer
List
Tuple Dictionary
Mutable Immutable. Mutable
Have order. Have structure. A dictionary is a key-value store.
t=['Red','Green','Blue'] (1,'Krrishnav',90) Dict={'Madrid':10,'Barcleona':20}
View full question & answer
Question 181 Mark
Write the difference between the list and string.
Answer
List are mutable and strings are immutable. Lists can be of any type of data i.e. integers, characters, strings etc, while strings can only hold a set of characters.
View full question & answer
Question 191 Mark
What is dictionary?
Answer
A dictionary is an ordered set of key:value pairs, where a key can be a number or a string and value can also be a number or a string. In Python a dictionary is created by putting the comma-separated key:value pairs of the dictionary in braces { }. For example, following is a small dictionary of three elements:

{'Dhoni':7, 'Kohli':18, 'Sachin':10}

View full question & answer
Question 201 Mark

What is Tuple?

Answer
A tuple is an ordered set of immutable heterogeneous elements. In Python a tuple can be created by putting the comma-separated elements of the tuple in parentheses().
For example, suppose we want to represent the following elements of a book with code: 1021, title 'Programming in Python', binding type 'Hard Bound', and edition 2018: As a tuple it is written as: (1021,'Programming in Python', 'Hard Bound', 2018).
View full question & answer
Question 211 Mark
What is a list?
Answer
A list is an ordered heterogeneous collection of elements. In Python, a list is created by putting the elements of the list in bracktes [ ].
For example, following is a list of five fruits:
['Grapes', 'Apple', 'Orange', 'Guava', 'Peach']
View full question & answer
Question 221 Mark
What is String?
Answer
A string is an immutable sequence of zero or more characters (letters, numbers, symbols) enclosed within quotation marks (' ' or "").
View full question & answer
1 Marks Each - Computer Science STD 12 Commerce Questions - Vidyadip