Programming and Problem Solving through Python

Introduction to Python Question & Answer



Question :
What is the difference between a keyword and an identifier?


Answer :

Every language has keywords and identifiers, which are only understood by its compiler. Keywords are predefined reserved words, which possess special meaning. An identifier is a unique name given to a particular variable, function or label of class in the program.



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


Answer :

Literals: Python comes with some built-in objects. Some are used so often that Python has a quick way to make these objects, called literals.

The literals include the string, Unicode string, integer, float, long, list, tuple and dictionary types.



Question :
What factors guide the choice of identifiers in program?


Answer :

(i) An identifier must start with a letter or underscore followed by any number of digits and/or letters.

(ii) No reserved word or standard identifier should be used.

(iii) No special character (Other than underscore) should be included in the identifier.



Question :
What are tokens in Python? How many types of tokens allowed in Python?


Answer :

Tokens are the smallest unit of the program. There are following tokens in Python:

  •  Reserved words or Keywords
  •  Identifiers
  •  Literals
  •  Operators
  •  Punctuators


Question :
What is the role of indentation in Python?


Answer :

Indentation plays a very important role in Python. Python uses indentation to create blocks of code. Statements at same indentation level are part of same block/suit. You cannot unnecessarily indent a statement; python will raise an error for that.



Question :
What are data types? What are Python built in core data types?


Answer :

Every value in Python has a datatype. Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes. There are various data types in Python. Some of the important types are listed below.

(i) Numbers

(ii) String

(iii) List

(iv) Tuple

(v) Dictionary



Question :
Which data types of Python handle Numbers?


Answer :

It is cleared by name that Number data types are used to store numeric value in Python. The Numbers in Python have following core data types:

(i) Integers

a. Integers (signed)

b. Booleans

(ii) Floating-Point Numbers

(iii) Complex Numbers



Question :
What do you understand by term immutable?


Answer :

Immutable types are those data types that can never change their value in place. In Python the following types are immutable:

(i) integers

(ii) floating-point numbers

(iii) Booleans

(iv) Strings

(v) Tuples



Question :
What are mutable and immutable types in Python? List both of them.


Answer :

They are as follows:

  •  Lists
  •  Dictionaries
  •  Sets

Immutable types are those data types that can never change their value in place. In Python the following types are immutable:

  •  integers
  •  floating-point numbers
  •  Booleans
  •  Strings
  •  Tuples


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad