[Type A] Chapter– 1 Class 12 CS – Sumita Arora Assignment | Q/A

Here is class 12 computer science Unit 1 [Type A] solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 1 and for all chapters here.

Watch all tutorials for chapter 1: Python Revision Tour – 1.

Q1: What are tokens in Python? How many types of tokens are allowed in Python? Exemplify your answer.

Tokens: A smallest/single element in Python is called Token.

There are 5 types of tokens in Python. Best way to remember them is by the term “POLIK”
P – Punctuators
O – Operators
L – Literals
I – Identifiers
K – Keywords

Tokens in Python & different types of tokens in Python
Q2: How are keywords different from identifiers?

Keywords are reserved words in python with specific meaning but identifiers are the name given to program element (variables, array, classes). Keywords can’t be used as identifiers.

Q3: What are literals in Python? How many types of literals are allowed in Python?

Literals are the raw data, input given in a variable or constant.

Types of literals are :
Numerical – such as Integer, Long, Float, Complex
String (‘hello’, ‘1234’), Boolean (True, False), Special (None), Unicode

Q4: Can nongraphic characters be used and processed in Python? How? Give examples to support your answer.

Yes, nongraphic characters are used in python and process according the reserve application to that respectively. For e.g. print(‘Morning is warm. \n Let’s Play’). Here ‘\n’ will act for breaking into next line.

Other nongraphic characters re ‘\b’, ‘\t’ etc.

Q5: Out of the following, find those identifiers, which cannot be used for naming Variables or Functions in a Python program :
Price*Qty, class, For, do, 4thCol, totally, Row31, _Amount

Price*Qty, class, 4thCol

Q6: How are floating constants represented in Python? Give examples to support your answer.

Floating constant are represented as by real number and the presiding sign to for positive or negative and if for no sign by default positive value.

For e.g. 3.14, 3.20, 34e-5, 2. etc.

Q7: How are string-literals represented and implemented in Python?

String literals are represented by the value in double or single quotes to a variable.

For e.g. ‘hello’, “going”, ‘1234’ etc.

Q8: What are the operators? What is their function ? Give examples of some unary and binary operators.

Operators are the special symbols in python that carry a special operation related to them. Such as ‘+’ for addition, ‘-‘ subtraction, ‘*’ for multiplication.

Unary operator are those which operate on only single operand such as : unary ! (invert) operator yields the bit-wise inversion unary – (minus) operator yields the negation of its numeric argument unary + (plus) operator yields its numeric argument unchanged

Binary operator are those which need two operands to act upon : binary + add both the operand to single value result. binary == compare the both operand for equality.

Q9: What is an expression and a statement?

Statement is an instruction that the python interpreter executes. Such as print and assignment. Sequence of statement make a resulting and working code.

Expression is the combination of operand and variable that needed to be evaluated to give result.

Q10: What all components can a Python program contain?
  • Python is a high level programming language constitute of components :
  • Function
  • Expression
  • Statement
  • Comments
  • Blocks
  • Indentation
Q11: What are the variables ? How are they important for a program?

Variables are name space of memory that hold a raw values for the operations. These are important for the flexible nature and storage purpose.

Q12: Describe the concepts of block or suite and body. What is an indentation and how is it related to block and body?

A block or suite is a compound statement that is a part of some named function.

An indentation is the left and right placing of the code and this hold out to be an important key in separating one block from other.

Q13: What are the data types? How are they important?

Data Types refers to the type of the data associated with data encountered while processing. Such as integer, string, list etc.

These play an important role as it reduces the changes of error and help to deal with separate data in better way.

Q14: How many integer types are supported by Python? Name them.

Two integer type are supported by python : Integer(signed) Long

Q15: What are immutable and mutable types? List immutable and mutable types of Python.

Immutable are the type which once initialized can’t be change. For e.g. Tuple, int, float, boolean.

Mutable are the types that can be change after initialization also. For e.g. List, set, dict.

Q16: What is the difference between implicit type conversion and explicit type conversion?

Implicit conversion are taken in account by the compiler or interpreter while the explicit conversion are done by the programmer itself.

Q18: What is the entry controlled loop? Which loop is entry controlled loop in Python?

Entry controlled loop are the structure which only start execution when the entry condition is satisfied.

For, while are the entry controlled loop in python.

Q19: Explain the use of the pass statement. Illustrate it with an example.

Pass statement is useful where the code satisfies the segment but eventually nothing having to execute.

Code: n=102 if n%2 ==0:
print(‘skip pass case’)

Q20: Below is seven segments of code, each with a part coloured. Indicate the data type of each coloured part by choosing the correct type of data from the following type.
(a) int (b) float (c) bool (d) str (e) function (f) list of int (g) list of str

(i) if temp<32:

(ii) L= [‘Hiya’, ‘Zoya’, ‘Preet’]

(iii) M = []
for i in range(3):

(iv) L= [‘Hiya’, ‘Zoya’, ‘Preet’]
n = len(L)
if ‘Donald’ in L[1:n]:

(v) if n%2 == 0:

(vi) L =inputline.split()
while L != ():
L = L[1:]

(vii) L= [‘Hiya’, ‘Zoya’, ‘Preet’]
print(L[0] +L[1])

(i)(d) str
(ii)(d) str
(iii)(f) list of int
(iv)(c) bool
(v)(d) str
(vi)(g) list of str
(vii)(d) str

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

You cannot copy content of this page