This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1Which one is NOT a feature of Python Language?
Option C
Python is a popular high-level programming language known for its simplicity and readability. It is a high-level, interpreted language and portable across different operating systems.
However, Python is case-sensitive language. This means uppercase and lowercase letters are treated differently.
>>>name = "Suresh"
>>>Name = "Rampayari"
>>print(name)
>>>print(Name)
Here, name and Name are treated as two different variables.
Q: 2What is the meaning of >>> in Python Language?
Option C
In Python, the symbol >>> is called the Python Prompt. It appears in the Python interpreter when Python is ready to accept and execute commands entered by the user.
It indicates that the interpreter is active and waiting for instructions.
Q: 3Which of the following declarations is incorrect in python language?
Option B
In Python, writing xyzp = 5,000,000 is syntactically correct, but it does not store the integer 5000000. Instead, Python treats the commas as separators and creates a tuple (5, 0, 0). If we want to store 5000000 in python variable then correct way is either xyzp = 5000000 or xyzp = 5_000_000 for readability.
The statement, x, y, z, p = 5000, 6000, 7000, 8000 uses tuple unpacking, assigning each number to a separate variable: x = 5000, y = 6000, z = 7000, and p = 8000. This is a valid and commonly used Python syntax.
The statement, x_y_z_p = 5,000,000, is similar to statement xyzp = 5,000,000. It is syntactically correct, and the variable name is valid, but the value becomes a tuple (5, 0, 0).
The statement, xyzp = 5000 6000 7000 8000, is completely invalid in Python. The numbers cannot be written separated by spaces, and this will throw a syntax error.
Q: 4Which statement(s) is/are NOT true about the variables in Python Language:
I. Values of every variable can be changed once a variable has been created and assigned value.
II. Assignment statement is used to create a new variable and assign value.
Option A
In Python, variables are created using an assignment statement. The assignment operator = is used to assign a value to a variable. Therefore, Statement II is true because assignment statements are used to create variables and assign values.
The Statement I is that “Values of every variable can be changed once a variable has been created and assigned value.”
This statement is not always true because Python has both Mutable (list, dictionary, set) and Immutable (int, float, tuple, string) data types. The immutable objects cannot be changed after creation.
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.