post

11th (ਕੰਪਿਊਟਰ ਸਾਇੰਸ/Computer Science) - 2026-27

ਪਾਠ-2/Chapter-2
ਪਾਇਥਨ ਪ੍ਰੋਗਰਾਮਿੰਗ ਸਬੰਧੀ ਮੂਲ ਧਾਰਨਾਵਾਂ/Basic Concepts of Python Programming





Q-1.
The ______________ is a default editor that accompanies Python.
The ______________ is a default editor that accompanies Python.
Q-1. Objective  

1) IDLE/IDLE
2) IPLE/IPLE
3) Text Editor/Text Editor
4) Notepad/Notepad

Ans.) IDLE/IDLE

Q-2.
The ______________ is the shell prompt where we type in our commands.
The ______________ is the shell prompt where we type in our commands.
Q-2. Objective  

1) <</<<
2) >>/>>
3) >>>/>>>
4) <<</<<<

Ans.) >>>/>>>

Q-3.
IDE Stands for ...........
IDE Stands for ...........
Q-3. Objective  

1) Integrated Direct Environment/Integrated Direct Environment
2) Integrated Development Environment/Integrated Development Environment
3) Information Development Environment/Information Development Environment
4) None of these/None of these

Ans.) Integrated Development Environment/Integrated Development Environment

Q-4.
To run a script file code in Python, we can use ___________ shortcut key.
To run a script file code in Python, we can use ___________ shortcut key.
Q-4. Objective  

1) F1/F1
2) F2/F2
3) F5/F5
4) F7/F7

Ans.) F5/F5

Q-5.
___________ are like words and punctuation marks in English language.
___________ are like words and punctuation marks in English language.
Q-5. Objective  

1) Literals/Literals
2) Identifiers/Identifiers
3) Variables/Variables
4) Tokens/Tokens

Ans.) Tokens/Tokens

Q-6.
Literals are the______________ values used in a source code.
Literals are the______________ values used in a source code.
Q-7. Objective  

1) Fixed/Fixed
2) Boolean/Boolean
3) String/String
4) Float/Float

Ans.) Fixed/Fixed

Q-7.
___________ are those identifiers which are used to store values and they allow us to change their value during runtime
___________ are those identifiers which are used to store values and they allow us to change their value during runtime
Q-8. Objective  

1) Constant/Constant
2) Variable/Variable
3) List/List
4) Tokens/Tokens

Ans.) Variable/Variable

Q-8.
A comment is basically a text that gives an ______________ about the program code.
A comment is basically a text that gives an ______________ about the program code.
Q-9. Objective  

1) Execution/Execution
2) Compilation/Compilation
3) Explanation/Explanation
4) All of these/All of these

Ans.) Explanation/Explanation

Q-9.
We can display program data to the console in Python with ________ function.
We can display program data to the console in Python with ________ function.
Q-10. Objective  

1) input()/input()
2) print()/print()
3) output()/output()
4) show()/show()

Ans.) print()/print()

Q-10.
What do you know about Python?
What do you know about Python?
Q-1. Short Answer Type Questions  

Python is a popular programming language. It was developed by Guido Van Rossum. It was introduced in 1991. After that, it was developed by the Python Software Foundation. It is a general-purpose High-Level Programming language. The code produced in this language is small and flexible. Python is often used in the fields of Data Science, AI (Artificial Intelligence), and ML (Machine Learning).




Python is a popular programming language. It was developed by Guido Van Rossum. It was introduced in 1991. After that, it was developed by the Python Software Foundation. It is a general-purpose High-Level Programming language. The code produced in this language is small and flexible. Python is often used in the fields of Data Science, AI (Artificial Intelligence), and ML (Machine Learning).



Q-11.
What is IDE?
What is IDE?
Q-2. Short Answer Type Questions  

IDE stands for Integrated Development Environment. It is a software that is dedicated to software
development. IDEs integrate several tools for software development. These usually include the following tools:
1) A Text Editor to handle Source Code.
2) Build, Execution, and Debugging Tools




IDE stands for Integrated Development Environment. It is a software that is dedicated to software
development. IDEs integrate several tools for software development. These usually include the following tools:
1) A Text Editor to handle Source Code.
2) Build, Execution, and Debugging Tools



Q-12.
How can you view the list of Keywords using Python Shell? Write some examples of Keywords.
How can you view the list of Keywords using Python Shell? Write some examples of Keywords.
Q-3. Short Answer Type Questions  

Keywords are also known as Reserve Words. To view the list of keywords using the Python shell, we can use the following Python statements:
>>> import keyword
>>> print(keyword.kwlist)
Some of examples of keywords are: True, False, if, elif, else, while, for etc.




Keywords are also known as Reserve Words. To view the list of keywords using the Python shell, we can use the following Python statements:
>>> import keyword
>>> print(keyword.kwlist)
Some of examples of keywords are: True, False, if, elif, else, while, for etc.



Q-13.
How will you declare variables in Python? Given Examples.
How will you declare variables in Python? Given Examples.
Q-4. Short Answer Type Questions  

Variable are used to hold values in memory. There is no special command in Python to declare a variable. A variable comes into existence in memory automatically when we assign a value to it. The interpreter allocates memory to the variable according to the data type of the value assigned to it. For example:
x = 12
In this example, the variable 'x' is declared as an integer variable.




Variable are used to hold values in memory. There is no special command in Python to declare a variable. A variable comes into existence in memory automatically when we assign a value to it. The interpreter allocates memory to the variable according to the data type of the value assigned to it. For example:
x = 12
In this example, the variable 'x' is declared as an integer variable.



Q-14.
Why print() function is used in Python programs?
Why print() function is used in Python programs?
Q-5. Short Answer Type Questions  

The print() function is used to display output in Python programs. This function can be used to display program data on the console screen. By default, the print() function displays values separated by a single space. This function inserts a newline at the end after displaying its output.

Example:
print(“Hello”, "Students")
print(“How are you?”)

Output:
Hello Students
How are you?




The print() function is used to display output in Python programs. This function can be used to display program data on the console screen. By default, the print() function displays values separated by a single space. This function inserts a newline at the end after displaying its output.

Example:
print(“Hello”, "Students")
print(“How are you?”)

Output:
Hello Students
How are you?



Q-15.
Define Tokens? Explain various types of tokens used in Python.
Define Tokens? Explain various types of tokens used in Python.
Q-1. Long Answer Type Questions  

Every program is made up of different types of tokens. These tokens are like words and punctuation marks in the English language. They are the smallest individual elements in a program. The tokens used in Python programs are described below:
1) Keywords: These are the Reserve Words.
2) Identifiers: These are the names given to program elements, such as variables, functions etc.
3) Literals: These are the fixed values used in the Source Code.
4) Operators: These tokens are used to perform operations in the expressions.
5) Delimiters: These are special characters that play specific roles (grouping, punctuation, etc.) in Python.




Every program is made up of different types of tokens. These tokens are like words and punctuation marks in the English language. They are the smallest individual elements in a program. The tokens used in Python programs are described below:
1) Keywords: These are the Reserve Words.
2) Identifiers: These are the names given to program elements, such as variables, functions etc.
3) Literals: These are the fixed values used in the Source Code.
4) Operators: These tokens are used to perform operations in the expressions.
5) Delimiters: These are special characters that play specific roles (grouping, punctuation, etc.) in Python.



Q-16.
What are Identifiers? Write their naming rules.
What are Identifiers? Write their naming rules.
Q-2. Long Answer Type Questions  

The names given to program elements such as variables, functions, etc. are called identifiers. To define the names of elements in a program, we have to use the following naming rules:

  • Identifiers must be made up of a combination of lowercase (a-z) or uppercase (A-Z) alphabets, digits (0-9) or underscore (_).
  • Identifiers cannot start with a digit.
  • No keyword can be used as an identifier.
  • No symbol or special character other than underscore (_) can be used in identifiers.
  • Identifiers can be of any length; there is no restriction on the length of identifiers.
  • Python is a case sensitive language. Therefore, the case of the alphabet is important in naming identifiers.

For example: roll and ROLL are two different identifiers.

  • Whitespaces cannot be used in an identifier.



The names given to program elements such as variables, functions, etc. are called identifiers. To define the names of elements in a program, we have to use the following naming rules:

  • Identifiers must be made up of a combination of lowercase (a-z) or uppercase (A-Z) alphabets, digits (0-9) or underscore (_).
  • Identifiers cannot start with a digit.
  • No keyword can be used as an identifier.
  • No symbol or special character other than underscore (_) can be used in identifiers.
  • Identifiers can be of any length; there is no restriction on the length of identifiers.
  • Python is a case sensitive language. Therefore, the case of the alphabet is important in naming identifiers.

For example: roll and ROLL are two different identifiers.

  • Whitespaces cannot be used in an identifier.


Q-17.
What are Literals? Draw a chart to represents the different types of literals used in Python.
What are Literals? Draw a chart to represents the different types of literals used in Python.
Q-3. Long Answer Type Questions  

Literals are fixed values that are used in the source code of a program. These values are usually assigned to program elements, such as variables, etc. The different types of literals used in Python are shown in the chart shown below:

 


post

Literals are fixed values that are used in the source code of a program. These values are usually assigned to program elements, such as variables, etc. The different types of literals used in Python are shown in the chart shown below:

post

Q-18.
What are Comments? Write the different ways of writing comments in Python.
What are Comments? Write the different ways of writing comments in Python.
Q-4. Long Answer Type Questions  

Comments are the integral part of a program. A comment in the program is a text that explains the code written in the program. The compiler and interpreter ignore these comments and do not execute them. They make the code easier to understand. There are mainly two ways to write comments in Python programs:
1) Single Line Comments: These comments are written in a single line. For Example:
# This is an example of a single comment

2) Multiline or Block Comments: These comments are written in more than one line. For Example:
“““This is a multiline
comment.”””




Comments are the integral part of a program. A comment in the program is a text that explains the code written in the program. The compiler and interpreter ignore these comments and do not execute them. They make the code easier to understand. There are mainly two ways to write comments in Python programs:
1) Single Line Comments: These comments are written in a single line. For Example:
# This is an example of a single comment

2) Multiline or Block Comments: These comments are written in more than one line. For Example:
“““This is a multiline
comment.”””