Contents

The list.index(x[, start[, end]]) is used to ___.
a) Return zero-based index in the list
b) Raises a ValueError if there is no such item
c) Both A and B
d) None of these

c

Explanation: The index(x[, start[, end]]) is used to return the zero-based index in the list of the first item whose value is equal to x. index() is used to return the zero-based index in the list of the first item whose value is equal to x. If there is no such item, the method raises a ValueError. The optional arguments start and end are interpreted in the same way as in the slice notation and are used to restrict the search to a specific subsequence of the list of elements. Instead of using the start argument to calculate the index, the returned index is computed relative to the beginning of the full sequence.


Python Dictionary is used to store the data in a ___ format.
a) Key value pair
b) Group value pair
c) Select value pair
d) None of the mentioned above

a

Explanation: Python Dictionary is used to store the data in a key-value pair format, which is similar to that of a database. The dictionary data type in Python is capable of simulating the real-world data arrangement in which a specific value exists for a specific key when the key is specified. It is the data-structure that can be changed. Each element of the dictionary is defined as follows: keys and values.


In a Python program, Nested if Statements denotes?
a) if statement inside another if statement
b) if statement outside the another if statement
c) Both A and B
d) None of the mentioned above

a

Explanation: Nesting an if statement within another if statement is referred to as nesting in the programming community. It is not always necessary to use a simple if statement; instead, you can combine the concepts of if, if-else, and even if-elif-else statements to create a more complex structure.


In Python, ___ defines a block of statements.
a) Block                                
b) Loop
c) Indentation     
d) None of these

c

Explanation: Python's concept of indentation is extremely important because, if the Python code is not properly indented, we will encounter an Indentation Error and the code will not be able to be successfully compiled. In Python, to indicate a block of code, we must indent each line of the block by the same amount on each line of the block. As a result, indentation denotes the beginning of a block of statements.


In Python, the break and continue statements, together are called ___ statement.
a) Jump                                
b) goto
c) compound                       
None of these

b

Explanation: With the goto statement in Python, we are basically telling the interpreter to skip over the current line of code and directly execute another one instead of the current line of code. You must place a check mark next to the line of code that you want the interpreter to execute at this time in the section labelled "target."


Loops are known as ___ in programming.
a) Control flow statements
b) Conditional statements
c) Data structure statements
d) None of the mentioned above

a

Explanation: The control flow of a program refers to the sequence in which the program's code is executed. Conditional statementsloops, and function calls all play a role in controlling the flow of a Python program's execution.