by Himanshu Garg

Section A – Multiple Choice Questions (1 mark each)

  1. State True or False: Identifiers are names used to identify a variable, function in a program.
    SHOW ANSWER

    Answer: True

    Explanation: Identifiers are indeed names used in programming to identify variables, functions, classes, modules, etc.

  2. Which of the following is a valid keyword in Python?
    a) false   b) return   c) non_local   d) none
    SHOW ANSWER

    Answer: b) return

    Explanation: “return” is a keyword in Python, whereas “false,” “non_local,” and “none” are not written correctly. The correct keywords would be “False,” “nonlocal,” and “None.”

  3. Given the following Tuple: Tup = (10, 20, 30, 50), which of the following statements will result in an error?
    a) print(Tup[0])   b) Tup.insert(2,3)   c) print(Tup[1:2])   d) print(len(Tup))
    SHOW ANSWER

    Answer: b) Tup.insert(2,3)

    Explanation: Tuples are immutable, so you cannot insert elements into them. The other operations are valid.

  4. Consider the given expression: 5<10 and 12>7 or not 7>4. What will be the correct output if the given expression is evaluated?
    a) True   b) False   c) NONE   d) NULL
    SHOW ANSWER

    Answer: a) True

    Explanation: Breaking it down:

    • 5 < 10 is True
    • 12 > 7 is True
    • not 7 > 4 is False

    Using the logic: True and True or False evaluates to True.

  5. Select the correct output of the following code:
    S = "Amrit Mahotsav@ 75"
    A = S.partition(" ")
    print(A)

    a) (‘Amrit Mahotsav’, ‘@’, ’75’)   b) [‘Amrit’, ‘Mahotsav’, ‘@’, ’75’]   c) (‘Amrit’, ‘Mahotsav@ 75’)   d) (‘Amrit’, ‘Mahotsav@ 75′, ’75’)

    SHOW ANSWER

    Answer: c) (‘Amrit’, ‘Mahotsav@ 75’)

    Explanation: The partition() method splits the string at the first occurrence of the specified separator (space in this case) and returns a tuple of three elements: the part before the separator, the separator itself, and the part after the separator.

  6. Which of the following mode keeps the file offset position at the end of the file?
    a) r+   b) r   c) w   d) a
    SHOW ANSWER

    Answer: d) a

    Explanation: The ‘a’ mode (append) opens the file for writing and sets the file pointer at the end of the file.

  7. Which function is used to arrange the elements of a list in ascending order?
    a) sort()   b) arrange()   c) ascending()   d) asort()
    SHOW ANSWER

    Answer: a) sort()

    Explanation: The sort() function sorts the list in ascending order by default.

  8. Which of the following operators will return either True or False?
    a) +=   b) !=   c) =   d) *=
    SHOW ANSWER

    Answer: b) !=

    Explanation: The != is a comparison operator that returns True if the values are not equal, otherwise False.

  9. Which statement(s) would give an error after executing the following code?
    Stud = {"Murugan": 100, "Mithu": 95}
    print(Stud[95])

    a) Statement 2   b) Statement 3   c) Statement 4   d) Statements 2 and 4

    SHOW ANSWER

    Answer: a) Statement 2

    Explanation: The error occurs because 95 is not a key in the dictionary Stud. Dictionary keys are “Murugan” and “Mithu.”

  10. ___ is the number of tuples in a relation.
    a) Attribute   b) Degree   c) Domain   d) Cardinality
    SHOW ANSWER

    Answer: d) Cardinality

    Explanation: Cardinality refers to the number of tuples (rows) in a relation (table), while degree refers to the number of attributes (columns).

  11. The syntax of seek() is: file object.seek(offset[, reference_point]). What is the default value of the reference point?
    a) 0   b) 1   c) 2   d) 3
    SHOW ANSWER

    Answer: a) 0

    Explanation: By default, the reference point is 0, which means the offset is from the beginning of the file.

  12. ___ clause is used with the SELECT statement to display data in a sorted form with respect to a specified column.
    a) WHERE   b) ORDER BY   c) HAVING   d) DISTINCT
    SHOW ANSWER

    Answer: b) ORDER BY

    Explanation: The ORDER BY clause is used to sort the data retrieved by the SELECT statement.

  13. ___ communication is used for point-to-point communication such as radar and satellite.
    a) INFRARED WAVES   b) BLUETOOTH   c) MICROWAVES   d) RADIOWAVES
    SHOW ANSWER

    Answer: c) MICROWAVES

    Explanation: Microwaves are used for point-to-point communication like satellite communication.

  14. What will the following expression evaluate to?
    print(4 + 3 * 5 / 3 - 5 % 2)

    a) 8.5   b) 8.0   c) 10.2   d) 10.0

    SHOW ANSWER

    Answer: b) 8.0

    Explanation: The expression follows the BODMAS rule, and the result is 8.0.

  15. Which function returns the sum of all elements of a list?
    a) count()   b) sum()   c) total()   d) add()
    SHOW ANSWER

    Answer: b) sum()

    Explanation: The sum() function returns the sum of all the elements of a list.

  16. fetchall() method fetches all rows in a result set and returns a:
    a) Tuple of lists   b) List of tuples   c) List of strings   d) Tuple of strings
    SHOW ANSWER

    Answer: b) List of tuples

    Explanation: The fetchall() method returns a list of tuples, where each tuple represents a row from the result set.

  17. Assertion (A): To use a function from a particular module, we need to import the module.
    Reason (R): import statement can be written anywhere in the program, before using a function from that module.
    a) Both (A) and (R) are true and (R) is the correct explanation for (A).
    b) Both (A) and (R) are true and (R) is not the correct explanation for (A).
    c) (A) is true but (R) is false.
    d) (A) is false but (R) is true.
    SHOW ANSWER

    Answer: c) (A) is true but (R) is false.

    Explanation: The import statement must be written at the top of the program, not just anywhere, before using a module’s function.

  18. Assertion (A): A stack is a LIFO structure.
    Reason (R): Any new element pushed into the stack always gets positioned at the index after the last existing element in the stack.
    a) Both (A) and (R) are true and (R) is the correct explanation for (A).
    b) Both (A) and (R) are true and (R) is not the correct explanation for (A).
    c) (A) is true but (R) is false.
    d) (A) is false but (R) is true.
    SHOW ANSWER

    Answer: b) Both (A) and (R) are true and (R) is not the correct explanation for (A).

    Explanation: While both statements are true, the reason does not explain the LIFO structure correctly.

Leave a Reply

[script_15]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. OK Read More

Privacy & Cookies Policy
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00
✓ Customized M.Tech Projects | ✓ Thesis Writing | ✓ Research Paper Writing | ✓ Plagiarism Checking | ✓ Assignment Preparation | ✓ Electronics Projects | ✓ Computer Science | ✓ AI ML | ✓ NLP Projects | ✓ Arduino Projects | ✓ Matlab Projects | ✓ Python Projects | ✓ Software Projects | ✓ Readymade M.Tech Projects | ✓ Java Projects | ✓ Manufacturing Projects M.Tech | ✓ Aerospace Projects | ✓ AI Gaming Projects | ✓ Antenna Projects | ✓ Mechatronics Projects | ✓ Drone Projects | ✓ Mtech IoT Projects | ✓ MTech Project Source Codes | ✓ Deep Learning Projects | ✓ Structural Engineering Projects | ✓ Cloud Computing Mtech Projects | ✓ Cryptography Projects | ✓ Cyber Security | ✓ Data Engineering | ✓ Data Science | ✓ Embedded Projects | ✓ AWS Projects | ✓ Biomedical Engineering Projects | ✓ Robotics Projects | ✓ Capstone Projects | ✓ Image Processing Projects | ✓ Power System Projects | ✓ Electric Vehicle Projects | ✓ Energy Projects Mtech | ✓ Simulation Projects | ✓ Thermal Engineering Projects

© 2024 All Rights Reserved Engineer’s Planet

Digital Media Partner #magdigit