Python Basics
Python Basics - Important Points
1. | What is Python? |
---|
A. A high-level programming language
B. A database management system
C. A low-level programming language
D. A markup language
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
2. | Which of the following is an advantage of using Python? |
---|
A. Easy to learn and use
B. Low-level access to system resources
C. Better performance than other programming languages
D. Limited library support
View Answer Discuss Work SpaceAnswer: option a
Explanation:
One of the key advantages of Python is that it is easy to learn and use.
3. | Which of the following is a valid variable name in Python? |
---|
A. 123var
B. _variable
C. class
D. 2_for_1
View Answer Discuss Work SpaceAnswer: option b
Explanation:
Variable names in Python can start with a letter or underscore (), but not a number. They can also include letters, numbers, and underscores.
4. | What is the output of the following code? print(7 % 3) |
---|
A. 2
B. 3
C. 1
D. 7
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The % operator returns the remainder of dividing 7 by 3, which is 1.
5. | Which of the following is a valid way to comment a single line of Python code? |
---|
A. // This is a comment
B. /* This is a comment */
C. # This is a comment
D. // This is a comment //
View Answer Discuss Work SpaceAnswer: option c
Explanation: