84
54k

310+ Problem Solving and Python Programming Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Electrical Engineering , Civil Engineering , Mechanical Engineering .

Chapters

Chapter: Algorithms
1.

The word                         comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi.

A. flowchart
B. flow
C. algorithm
D. syntax
Answer» C. algorithm
Explanation: the word algorithm comes from the name of a persian mathematician abu ja’far mohammed ibn-i musa al khowarizmi.
2.

In computer science, algorithm refers to a special method usable by a computer for the solution to a problem.

A. true
B. false
Answer» A. true
Explanation: the statement is true. this word algorithm refers to a special method usable by a computer for the solution to a problem. the statement of the problem specifies in general terms the desired input/output relationship.
3.

This characteristic often draws the line between what is feasible and what is impossible.

A. performance
B. system evaluation
C. modularity
D. reliability
Answer» A. performance
Explanation: algorithms help us to understand scalability. performance often draws the line between what is feasible and what is impossible.
4.

The time that depends on the input: an already sorted sequence that is easier to sort.

A. process
B. evaluation
C. running
D. input
Answer» C. running
Explanation: the running time depends on the input: an already sorted sequence is easier to sort. the running time is given by the size of the input, since short sequences are easier to sort than the longer ones. generally, we seek upper bounds on the running time, because it is reliable.
5.

When an algorithm is written in the form of a programming language, it becomes a

A. flowchart
B. program
C. pseudo code
D. syntax
Answer» B. program
Explanation: an algorithm becomes a program when it is written in the form of a programming language. thus, any program is an algorithm.
6.

Any algorithm is a program.

A. true
B. false
Answer» B. false
Explanation: the statement is false. an algorithm is represented in the form of a programming language is called a program. any program is an algorithm but the reverse is not true.
7.

A system wherein items are added from one and removed from the other end.

A. stack
B. queue
C. linked list
D. array
Answer» B. queue
Explanation: in a queue, the items are inserted from the rear end and deleted from the front end.
8.

Another name for 1-D arrays.

A. linear arrays
B. lists
C. horizontal array
D. vertical array
Answer» A. linear arrays
Explanation: linear arrays are the 1- dimensional arrays wherein only one row is present and the items are inserted.
9.

A data structure that follows the FIFO principle.

A. queue
B. ll
C. stack
D. union
Answer» A. queue
Explanation: the answer is queue. a queue follows the fifo principle. fifo stands for first in first out.
Chapter: Flow Charts
10.

The symbol denotes                

A. i/o
B. flow
C. terminal
D. decision
Answer» C. terminal
Explanation: the symbol denotes a terminal. it is used for indication of start and stop nodes of a program.
11.

In computer science, algorithm refers to a pictorial representation of a flowchart.

A. true
B. false
Answer» B. false
Explanation: the statement is false. the correct statement would be: in computer science, flowchart refers to a pictorial representation of an algorithm.
12.

The process of drawing a flowchart for an algorithm is called                      

A. performance
B. evaluation
C. algorithmic representation
D. flowcharting
Answer» D. flowcharting
Explanation: it is called as flowcharting. a flowchart is nothing but a pictorial representation of an algorithm.
13.

Actual instructions in flowcharting are represented in                      

A. circles
B. boxes
C. arrows
D. lines
Answer» B. boxes
Explanation: the actual instructions are written in boxes. boxes are connected by using arrows to indicate the exact flow of a flowchart and the order in which they are to be executed.
14.

The following box denotes?

The following box denotes?
A. decision
B. initiation
C. initialization
D. i/o
Answer» A. decision
Explanation: a diamond shape box denotes the decision making statements. it jumps to a truth value or a false value.
15.

A box that can represent two different conditions.

A. rectangle
B. diamond
C. circle
D. parallelogram
Answer» B. diamond
Explanation: a diamond shape box denotes either a truth value or a false value. it jumps onto two different statements following it via flow lines.
16.

There should be certain set standards on the amount of details that should be provided in a flowchart.

A. true
B. false
Answer» B. false
Explanation: the statement is false. there should be no set standards on the amount of details that should be provided in a flowchart.
17.

A detailed flowchart is called              

A. stack
B. macro
C. micro
D. union
Answer» C. micro
Explanation: a detailed flowchart or a flowchart with more details is called as micro flowchart. it represents all the components of the algorithm that is followed.
18.

Which of the following is not an advantage of a flowchart?

A. better communication
B. efficient coding
C. systematic testing
D. improper documentation
Answer» D. improper documentation
Explanation: flowcharts provide a proper documentation. it also provides systematic debugging.
19.

A flowchart that outlines the main segments of a program.

A. queue
B. macro
C. micro
D. union
Answer» B. macro
Explanation: the answer is macro flowchart. a macro flowchart outlines the important components of a program. it therefore shows fewer details.
Chapter: Designing Flowcharts
20.

A                              is diagram that depicts the flow of a program.

A. algorithm
B. hash table
C. graph
D. flowchart
Answer» D. flowchart
Explanation: a flowchart is a diagram that helps us determine the flow of the program. other options are irrelevant.
21.

Terminals are represented by diagonals in a flowchart.

A. true
B. false
Answer» B. false
Explanation: the statement is false. terminals are represented by rounded rectangles. they indicate the starting or ending point in a flowchart.
22.

The operation represented by parallelograms.

A. input/output
B. assignment
C. comparison
D. conditions
Answer» A. input/output
Explanation: the input/output operations are represented by parallelograms. they generally are used to display messages during input and output part of a program.
23.

Which of the following is not a flowchart structure?

A. process
B. sequence
C. repetition
D. case
Answer» A. process
Explanation: there are basically four flowcharting structures:
24.

The action performed by a                         structure must eventually cause the loop to terminate.

A. sequence
B. case
C. repetition
D. process
Answer» C. repetition
Explanation: the action performed by a repetition structure must eventually cause the loop to terminate. otherwise, an infinite loop is created.
25.

The following symbol denotes:

A. module
B. terminal
C. process
D. i/o operation
Answer» A. module
Explanation: this symbol is that of a module. the terminal is denoted by a rounded rectangle. i/o operation by a parallelogram and process by a rectangle.
26.

What type of structure is this?

What type of structure is this?
A. sequence
B. case
C. repetition
D. process
Answer» C. repetition
Explanation: this is a repetition structure. the action performed by a repetition structure must eventually cause the loop to terminate. otherwise, an infinite loop is created.
27.

A                is a connector showing the relationship between the representative shapes.

A. line
B. arrow
C. process
D. box
Answer» B. arrow
Explanation: arrows are the connectors that show the relationship between different
28.

The following box denotes?

A. decision
B. input/output
C. process
D. module
Answer» A. decision
Explanation: the answer is decision. conditions are given in this box and then the result is checked accordingly if the condition is true or false.
Chapter: Pseudo Code
29.

Capitalize initial keyword – This is a rule while writing a pseudo code.

A. true
B. false
Answer» A. true
Explanation: the statement is true. it is an important rule to capitalize the initial keyword while writing a pseudo code.
30.

                             is used to show hierarchy in a pseudo code.

A. indentation
B. curly braces
C. round brackets
D. semicolon
Answer» A. indentation
Explanation: each design structure uses a particular indentation pattern.
31.

The statement that tells the computer to get a value from an input device and store it in a memory location.

A. read
B. write
C. read
D. write
Answer» C. read
Explanation: the read statement is used to take the input. read being a keyword should be in capital letters.
32.

                         begins with lower case letters.

A. keywords
B. variables
C. tokens
D. functions
Answer» B. variables
Explanation: variables begin with a lowercase. they contain no spaces. they also involve the consistent use of names.
33.

Another notation for exponentiation.

A. *
B. **
C. ***
D. *^
Answer» B. **
Explanation: double asterisk sign is also used for exponentiation. the general notation is ^ sign.
34.

A symbol used for grouping.

A. ()
B. {}
C. []
D. ” ”
Answer» A. ()
Explanation: parenthesis is used for grouping while working with fields. there are other symbols like *, +, -, **, etc.
35.

A statement used to close the IF block.

A. else
B. elseif
C. end
D. endif
Answer» D. endif
Explanation: the answer is endif. it is used
Chapter: Variables
36.

Is Python case sensitive when dealing with identifiers?

A. yes
B. no
C. machine dependent
D. none of the mentioned
Answer» A. yes
Explanation: case is always significant.
37.

What is the maximum possible length of an identifier?

A. 31 characters
B. 63 characters
C. 79 characters
D. none of the mentioned
Answer» D. none of the mentioned
Explanation: identifiers can be of any length.
38.

Which of the following is invalid?

A. _a = 1
B.     a = 1
C.     str     = 1
D. none of the mentioned
Answer» D. none of the mentioned
Explanation: all the statements will execute successfully but at the cost of reduced readability.
39.

Which of the following is an invalid variable?

A. my_string_1
B. 1st_string
C. foo
D. _
Answer» B. 1st_string
Explanation: variable names should not start with a number.
40.

Why are local variable names beginning with an underscore discouraged?

A. they are used to indicate a private variables of a class
B. they confuse the interpreter
C. they are used to indicate global variables
D. they slow down execution
Answer» A. they are used to indicate a private variables of a class
Explanation: as python has no concept of private variables, leading underscores are used to indicate variables that must not be accessed from outside the class.
41.

Which of the following is not a keyword?

A. eval
B. assert
C. nonlocal
D. pass
Answer» A. eval
Explanation: eval can be used as a variable.
42.

All keywords in Python are in                    

A. lower case
B. upper case
C. capitalized
D. none of the mentioned
Answer» D. none of the mentioned
Explanation: true, false and none are capitalized while the others are in lower case.
43.

Which of the following is an invalid statement?

A. abc = 1,000,000
B. a b c = 1000 2000 3000
C. a,b,c = 1000, 2000, 3000
D. a_b_c = 1,000,000
Answer» B. a b c = 1000 2000 3000
Explanation: spaces are not allowed in variable names.
44.

Which of the following cannot be a variable?

A. __init__
B. in
C. it
D. on
Answer» B. in
Explanation: in is a keyword.
Chapter: Operators
45.

Which is the correct operator for power(xy)?

A. x^y
B. x**y
C. x^^y
D. none of the mentioned
Answer» B. x**y
Explanation: in python, power operator is x**y i.e. 2**3=8.
46.

Which one of these is floor division?

A. /
B. //
C. %
D. none of the mentioned
Answer» B. //
Explanation: when both of the operands are integer then python chops out the fraction part and gives you the round off value, to get the accurate answer use floor division. this is floor division. for ex, 5/2 = 2.5 but both of the operands are integer so answer of this expression in python is 2. to get the 2.5 answer, use floor division.
47.

What is the answer to this expression, 22 % 3 is?

A. 7
B. 1
C. 0
D. 5
Answer» B. 1
Explanation: modulus operator gives the remainder. so, 22%3 gives the remainder, that is, 1.
48.

Mathematical operations can be performed on a string.

A. true
B. false
Answer» B. false
Explanation: you can’t perform mathematical operation on string even if the string is in the form: ‘1234…’.
49.

What is the output of this expression, 3*1**3?

A. 27
B. 9
C. 3
D. 1
Answer» C. 3
Explanation: first this expression will solve 1**3 because exponential has higher precedence than multiplication, so 1**3 = 1 and 3*1 = 3. final answer is 3.
50.

Which one of the following has the same precedence level?

A. addition and subtraction
B. multiplication, division and addition
C. multiplication, division, addition and subtraction
D. addition and multiplication
Answer» A. addition and subtraction
Explanation: “addition and subtraction” are at the same precedence level. similarly, “multiplication and division” are at the same precedence level. however, multiplication and division operators are at a higher precedence level than addition and subtraction operators.

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.