0% found this document useful (0 votes)
8 views51 pages

Python Programming Basics for Class XI

This document contains multiple-choice questions (MCQs) and answers related to Computer Science for Class XI, focusing on computational thinking and Python programming. It covers topics such as problem-solving techniques, Python syntax, identifiers, and built-in functions. The document serves as study material for students to familiarize themselves with key concepts in programming and algorithm design.

Uploaded by

Kanchana.R SVVV
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views51 pages

Python Programming Basics for Class XI

This document contains multiple-choice questions (MCQs) and answers related to Computer Science for Class XI, focusing on computational thinking and Python programming. It covers topics such as problem-solving techniques, Python syntax, identifiers, and built-in functions. The document serves as study material for students to familiarize themselves with key concepts in programming and algorithm design.

Uploaded by

Kanchana.R SVVV
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Vivekananda Educational Society

MCQ Study material – Computer Science – Class XI


Unit II Computational Thinking and Programming - I (Python)

Topic 1 Introduction to Problem Solving

1. ______ is a graphical representation of an algorithm.


a) Flowchart b) Algorithm c) Graphics d) Pseudocode

2. _____ is an informal way of describing the steps of a program’s solution.


a) Flowchart b) Algorithm c) Graphics d) Pseudocode

3. ____, _____, _____ and ____ are the four pillars of computation thinking.

4. ____ is a process of breaking down a complex problem into smaller parts.


a) Algorithm b) Abstraction c) Decomposition d) None of
these

5. _____ refers to looking for similarities among and within problems.


a) Algorithm b) Abstraction c) Pattern matching d) None of
these

6. _____ is a step-by-step procedure designed to perform an operation which will lead to the
desired result.
a) Flowchart b) Algorithm c) Pseudocode d) None of these

7. ______ involves selection of one of the alternatives based on outcomes of a condition.


a) Algorithm b) Pattern matching c) Decision making d) None of these
8. A set of instructions written using a programming language is termed as _____.
a) Source code b) Object code c) Machine code d) both b & c

9. The errors or defects in program are found in the _____ phase.


a) Coding b) Analyzing c) Testing d) All of the above

10. The characteristics of a good algorithm are ___


a) Precision b) Finiteness c) Uniqueness d) All of the above

11. The symbol used for processing in the flow charts is ______
a) b) c) d)

pg. 1
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

12. The symbol used for inputs and outputs in flow charts is
a) b) c) d)

13. The symbol used to show a decision is


a) b) c) d)

14. The symbol used to connect different parts of the code is


a) b) c) d)

15. There are no standard rules to write


a) Algorithm b) Pseudocode c) Flowchart d) none of these
16. ____ enables us to work out exactly what to tell the computer to do.
a) Computational thinking b) Pattern matching c) Decomposition d) none of these

17. Pseudocode keyword that is used to show the calculation is


a) COMPUTE b) CALCULATE c) CAL d) none of these

18. In which direction does the control flow in case of a flow chart?
a) Top to Bottom b) Bottom to Top c) Any direction d) Machine Dependent

19. When an algorithm is tested on papers by taking some sample inputs to check if the required
output is obtained is called _____
a) Run b) Dry Run c) Data Sharing d) none of these

20. When algorithm to be used?


a) only with computers b) only when programming
c) only with flow charts d) any time to design solutions to problems.

21. The shape represent the start and end of a flowchart?


a) oval b) rectangle c) diamond d) square

22. Which of the following is incorrect?


Algorithms can be represented.
a) as pseudo code b) as syntax c) as programs d) as flowcharts

pg. 2
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

23. What type of structure is this?


a) sequence b) case c) repetition d) process

24. Keep the statement language ____ while using a pseudo code.
a) dependent b) independent c) case sensitive d) capitalized

25. Capitalize initial keyword – This is a rule while writing a pseudo code.
a) True b) False c) machine dependent d) error

26. When an algorithm is written in the form of a programming language, it become a


a) flow chart b) program c) pseudo code d) syntax
27. First step in process of problem solving is to
a) design a solution b) define a problem
c) practicing the solution d) organizing the data
28. Second step in process of problem solving is to
a) design a solution b) define a problem
c) practicing the solution d) organizing the data

29. A search algorithm takes ____ as an input and returns ___ as an output.
a) input, output b) problem, solution
c) solution, problem d) parameters, sequence of actions

30. Things to keep in mind while solving a problem is


a) input data b) output data c) stored data d) all of above

pg. 3
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers for Topic 1 Introduction to Problem Solving


1. Flowchart
2. Pseudocode
3. Decomposition, Pattern matching, Abstraction and Algorithm
4. Decomposition
5. Pattern matching
6. Algorithm
7. Decision making
8. Source code
9. Testing
10. All of the above
11.

12.

13.

14.
15. Pseudocode
16. Computational thinking
17. COMPUTE
18. Top to Bottom
19. Dry Run
20. any time to design solutions to problems
21. oval
22. as syntax
23. repetition
24. independent
25. True
26. program
27. define a problem
28. design a solution
29. problem, solution
30. all of above

pg. 4
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Topic 2 Basics of Python programming – Familiarization

1. Which of the following is not considered a valid identifier in Python?


a) Two2 b) _main c) hello_repl d) 2hundred

2. Give two keywords in Python.

3. Name the built-in mathematical function that is used to return an absolute value of a number.

4. Identify the output


A=eval(input(“Enter”))
Enter 34
>>>print(type(A))
a) <class ‘int’> b) <class ‘str’> c) <class ‘tuple’> d) error

5. Which of the following can be used as valid variable identifier in Python?


a) 4thsum b) Total c) Number# d) _Data

6. Python is an _____ software.


a) Open-source b) Licensed c) Proprietary d) both a & b

7. Python was developed by _________ in ________ .

8. IDLE is a _____________________ .

9. Features of Python are ____


a) Platform independent b) Object-oriented c) Interpreted language d) All of the above

10. Python shell is an ____ window.


a) Interactive b) Script mode c) both d) none of these

pg. 5
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

11. Python is a case sensitive language. (True / False)

12. Python command prompt in IDLE is _____


a) >>> b) <<< c) << d) >>

13. All the programs in Python are saved with the ____ extension.
a) .py b) .pyw c) both a & b d) none of these

14. Single line comments in Python begins with ___ symbol.’


a) % b) “ c) ``` d) #

15. A variable can hold values of different types at different times is known as .

16. The print( ) without any value or name or expression print a blank line (True/False).

17. In Python, the floating point numbers have precision of ___ digits.
a) 12 b) 13 c) 14 d) 15

18. Identifier name cannot be composed of special characters other than ____
a) # b) hyphen (-) c) $ d) underscore( _ )

19. Python takes ____ idented spaces after the function declaration by default.
a) 5 b) 6 c) 4 d) 3

20. What can be the maximum possible length of an identifier?


a) 31 b) 63 c) 79 d) can be of any length

21. A fixed numeric or non-numeric value is called a ______


a) Literal b) Constant c) Variable d) both a & b

22. Identify the token X


a) Variable b) Identifier c) both a & b d) none of these

23. Identify the token 68


a) Variable b) Identifier c) Literal d) none of these

pg. 6
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

24. The shortcut for Run module on script mode is


a) F4 b) F5 c) F3 d) F6

25. The address of the object can be checked using ____ method.
a) address( ) b) id( ) c) type( ) d) print( )

26. Non-graphic characters are represented by using .

27. An escape sequence is represented by a ____ followed by one of more characters.


a) / b) \ c) // d) \\

28. Escape sequences to represent horizonal tab is ____.


a) \v b) \n c) \t d) \a

29. Each object is Python has three key attributes are ____ , _____ and _____.

30. In Python, the non-zero value is treated as and zero value is treated as

31. The two statements X = int(22.0/7) and X = int(22/7.0) yield the same results (True/False).
a) True b) False c) Machine dependent d) none of these

32. The given statement X + 1 = X is a valid statement (True / False).


a) True b) False c) Machine dependent d) none of these

33. Why Python is a Cross-Platform language?

34. What is the difference between the two statements? T = (0), T=(0,)

35. The smallest individual unit in a program is called _____


a) Keywords b) Integers c) Tokens d) Operators

36. Name some popular apps developed in Python.

37. Identify the output


print(False = = 0)

pg. 7
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

print(type(True) = = type(False))
a) True b) False c) True d) False
True True False False

38. Which of the following are not valid strings in Python?


a) “Hello” b) ‘Hello’ c) “Hello’ d) {Hello}

39. What is the type of the program element for main( )?


a) String literal b) Identifier c) Keyword d) Function

40. What would be the output of the following code snippets?


print(4+9, “4+9”)

41. Identify the output of the following code.


C = -3 + 8.9j
print(C)
a) -3 + 8.9j b) (-3 + 8.9j) c) 8.9j-3 d) (8.9j-3)

42. What is the difference between input and raw_input()?

43. The type of token for


a) Keyword b) Operator c) Punctuator d) Identifier

44. Name the module which need to be imported to invoke pi function?


a) math b) random c) pickle d) none of these

45. The non-literal in Python is ____


a) None b) none c) both a & b d) none of these

46. Which of the following will run without errors?


a) round(45.8) b) round(635.898,2,5) c) round( ) d) round(746.123,2,1)

47. Which of the following function is a built-in function in Python?


a) seed( ) b) sqrt( ) c) factorial( ) d) print( )

pg. 8
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

48. The function pow(x,y,z) is evaluated as


a) (x**y)%z b) (x**y)/z c) (x**y)**z d) (x**y)*z

49. Predict the output of the function all ([2,4,0,7])


a) Error b) True c) False d) none of these

50. Output of round (4.5676,2) is


a) 4.5 b) 4.6 c) 4.57 d) 4.56

51. Output of min(max(False,-3,-4),2,7) is


a) 2 b) False c) -3 d) -4

52. All keywords in Python are in _____


a) Lowercase b) Uppercase c) Capitalized d) none of these

pg. 9
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers: Basics of Python programming – Familiarization

1. 2hundred
2. for, while, if, elif
3. abs() or fabs( )
4. <class ‘int’>
5. Total & _Data
6. Open source
7. Guido Van Rossum, 1991
8. All of the above
9. simple, Integrated Development Learning Environment
10. Interactive
11. True
12. >>>
13. both a & b
14. #
15. Dynamic typing
16. True
17. 15
18. underscore( _ )
19. 4
20. can be of any length
21. both a & b
22. both a & b
23. Literal
24. F5
25. id( )
26. escape sequences
27. \
28. \t
29. type, a value and an id
30. true
false.
31. True
32. False

pg. 10
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

33. It can run equally well on variety of platforms such as windows, Linux, Unix etc.
34. T= (0) – create a variable with value 0, T=(0,)– create a tuple t with single element 0
35. Tokens
36. You tube, Google, Quora, Instagram
37. True
True
38. “Hello’ & {Hello}
39. Function
40. 13 4+9
41. (-3 + 8.9j)
42. input ( ) – reads the input and returns a python type like list, tuple, int etc.
raw_input( ) – reads the input and returns a string.
43. Punctuator
44. math
45. None
46. round(45.8)
47. print ( )
48. (x**y)%z
49. False
50. 4.57
51. False
52. Lowercase

pg. 11
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Topic 3 Knowledge of data types

1. Which of these is not a core data type?


a) list b) dictionary c) tuples d) class

2. Given a function that does not return any value. What value is thrown by default when
executed in shell?
a) int b) bool c) void d) None

3. Predict the output of the following code


Str = “hello”
Str[ 2]
a) he b) lo c) olleh d) hello

4. What is the return type of function id( )?


a) int b) float c) bool d) dict

5. What data type is the object given? L = [1,23, “hello”, 1]


a) list b) dict c) array d) tuple

6. In order to store values in terms of key and value, we use what core data type?
a) list b) dictionary c) tuples d) class

7. In Python we do not specify types, it is directly interpreted by the compiler, so consider the
following operation to be performed.
>>> X = 13 ? 2
Objective is to make sure X has a integer value, select all that apply.

pg. 12
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) X = 13//2 b) int(13/2) c) 13%2 d) all

8. Which of the following is incorrect?


a) float(‘inf’) b) float(‘nan’) c) float(‘56’+’78’) d) float(‘12+34’)

9. Which of the following is mutable data type in Python?


a) int b) string c) tuple d) list

10. To specify a string, we may use _____ quotes.


a) single b) double c) triple d) all

11. ______ data type is used to signify the absence of value/condition evaluating to false in a
situation.
a) Pass b) None c) none d) both b & c

12. A function in Python starts with a ____ keyword.


a) define b) def c) both d) none of these

13. Keys of a dictionary must be ______


a) same b) unique c) both a & b d) none of these

14. The ___ function returns the length of a specified list.


a) len( ) b) type( ) c) length( ) d) id( )

15. Lists and string in Python supports two-way indexing (True/False)


a) True b) False c) Machine dependent d) none of these

16. Predict the output

17. The process of arranging the array elements in a specified order is termed as ____
a) indexing b) slicing c) sorting d) traversing

pg. 13
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

18. ____ function is to find the occurrence of a string within another string.
a) find b) count c) append d) sort

19. Which are not correct type conversions?


a) int(7.0+0.1) b) str(1.2*3.4) c) float(“77”+”.0”) d) str(9/0)

20. Right index starts from _____


a) 0 b) 1 c) -1 d) none of these

21. Which of the following function convert a string to a float in Python?


a) int (x,[,base]) b) long(x,[,base]) c) float(x) d) str(x)

22. Which statement is incorrect?


a) list is immutable, tuple is mutable b) list is mutable, tuple is immutable
c) both are mutable d) both are immutable

23. Suppose a list with name arr contains 5 elements. You can get the 2nd element from the list
using.
a) arr[-2] b) arr[2] c) arr[-1] d) arr[1]

24. What type of data is arr[(1,1), (2,2), (3,3)]?


a) array of typles b) tuples of lists c) list of tuples d) invalid type

25. Which one of the following is mutable data type?


a) set b) int c) str d) tuple

26. Which one of the following is immutable data type?


a) list b) set c) int d) dict

27. What will be the data type of x after the following statement?
x = {‘lang’ ‘python’, ‘version’ 3}
a) list b) set c) dictionary d) tuple

28. What will be the data type of x after the following statement?
x = {2018, 2019, 2020, 2021}
a) list b) set c) dictionary d) tuple

pg. 14
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers: Topic 3 Knowledge of data types

1. class
2. None
3. he
4. int
5. list
6. dictionary
7. all
8. float(‘12+34’)
9. list
10. all
11. None
12. def
13. unique
14. len( )
15. True
16. 11 16 15
17. sorting
18. find
19. str(9/0)
20. -1
21. float(x)
22. list is mutable, tuple is immutable
23. arr[1]
24. list of tuples
25. set
26. int
27. dictionary
28. set

pg. 15
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Topic 4 Operators

1. Which is the correct operator for power(XY)?


a) X^Y b) X**Y c) X^^Y d) none of these

2. Which one of these is floor division?


a) / b) // c) % d) none of these

3. What is the of 22%3?


a) 7 b) 1 c) 0 d) 5

4. The output of 3*1**3?


a) 27 b) 9 c) 3 d) 1

5. The expression int(X) implies that the variable X is converted to integer. State True or False
a) True b) False c) both d) none of these

6. What is the order of precedence in Python?


i) Parentheses ii) Exponential iii) Multiplication
iv) Division v) Addition vi) Subtraction
a) i, ii, iii, iv, v, vi b) ii, i, iii, iv, v, vi c) ii, i, iv, iii, v, vi d) i, ii, iii, iv, vi, v

7. Mathematical operations can be performed on a string. State True or False


a) True b) False c) Machine dependent d) none of these

8. Operators with the same precedence are evaluated for which manner?
a) Left to Right b) Right to Left c) Can’t predict d) none of these

pg. 16
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

9. Which one of the following has the same precedence level?


a) Addition & Subtraction c) Multiplication, Division & Addition
b) Multiplication, Division, Addition & Subtraction d) Addition & Multiplication

10. Which one of the following has the highest precedence in the expression?
a) Exponential b) Addition c) Multiplication d) Parentheses

11. What does 3^4 evaluate to?


a) 81 b) 12 c) 0.75 d) 7

12. Which of the following output has its associating from right to left?
a) + b) // c) % d) **

13. What is the value of X, if X = int( 43.55 + 2/2)


a) 43 b) 44 c) 42 d) 23

14. What is the value of the following expression 2+4.00, 2**4.0


a) (6.0, 16.0) b) (6.00, 16.00) c) (6,16) d) (6.00,16.0)

15. What are the values of the following expressions


2**(3**2), (2**3)**2, 2**3**2
a) 64, 512, 64 b) 64, 64, 64 c) 512, 512, 512 d) 512, 64, 512

16. What is the value of float(22//3 + 3/3)?


a) 8 b) 8.0 c) 8.3 d) 8.33

17. The output of the line of code is ____


not(10 < 20) and not (10 > 30)
a) True b) False c) error d) no output

18. Which arithmetic operators cannot be used with string?


a) + b) * c) - d) all

19. Output of print(max(“What are you”))


a) error b) u c) t d) y

pg. 17
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

20. Output of “hello”+1+2+3?


a) hello123 b) hello c) error d) hello6

21. Predict the output

a) ((5,6), (7,8)) <class ‘tuple’> c) (5,6,7,8) <class ‘list’>


b) (5,6,7,8) <class ‘tuple’> d) (14,14) <class ‘tuple’>

22. Predict the output


A = 10
B = int(“10”)
print(A= = B)
print(A is B)

23. Evaluate 6 * 3 + 4 ** 2 // 5 - 8

24. Which one is a valid relationship operator in Python?


a) / b) = c) = = d) and

25. When evaluating an expression involving ____ operator, the second sub-expression is
evaluated only, if the first sub-expression yields False.
a) or b) and c) not d) none of these

26. When evaluating an expression involving ____ operator, the second sub-expression is
evaluated only, if the first sub-expression yields True.
b) or b) and c) not d) none of these

27. When relational operators are applied in strings, strings are compared from _____
a) left to right b) right to left c) both d) none of these

28. ______ truncated the fractional remainders and gives only the whole part of the result.
a) integer division b) floor division c) modulus d) none of these

29. Predict the output


X, Y = 2, 6

pg. 18
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

X, Y = Y, X+2
print(X, Y)
a) 2 6 b) 4 6 c) 6 4 d) 6 2

30. Evaluate 10 > 5 and 7 > 12 or not 18 > 3


a) True b) False c) Machine dependent d) none of these

31. The assignment operator in Python is _____


a) = = b) = c) both d) none of these

32. The operator that yield remainder is _____


a) / b) // c) % d) none of these

33. The output of 27//5 is _____


a) 5.4 b) 5 c) 2 d) 0

34. The output of -28/3 is ____


a) -9.3 b) 9 c) 1 d) 9.3

35. The output of -28 % 3 is _____


a) -1 b) -2 c) 1 d) 2

36. The output of 28 % -3 is _____


b) -1 b) -2 c) 1 d) 2

37. Concatenation operator in Python is _____


a) join b) + c) * d) **

38. An ____ operator takes only one operand.


a) unary b) binary c) both a & b d) none of these

39. _____ operators have higher precedence than ____ operators.


a) arithmetic, relational c) relational, arithmetic
b) both are equal precedence d) none of these

pg. 19
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

40. Output of “Hello” > “Goodbye” is


a) True b) False c) Machine dependent d) none of these

41. Output of “VI” > “IX” is


a) True b) False c) Machine dependent d) none of these

42. Output of “Bat” = = “Cat” is


a) True b) False c) Machine dependent d) none of these

43. In logical operators, ____ operator has higher precedence than ____ operator.
a) and, or b) not, and c) not, or d) all

44. ____ function is used to evaluate the value of the string and returns the numeric result.
a) eval( ) b) int( ) c) str( ) d) type( )

45. The statement b = str1 > str2 shall return ____ as the output if two strings str1 and
str2 contains “Delhi” and “New Delhi”
a) True b) Delhi c) New Delhi d) False

46. What are the membership operators in Python?

47. What are the identity operators in Python?

48. Does a slice operator always produce a new list?

49. ____ operator is used to replicate 2 strings.


a) + b) - c) * d) /

50. How many binary operators are in the following arithmetic expression?
-6 + 10 / (23 + 56)
a) 2 b) 3 c) 4 d) 5

pg. 20
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers: Topic 4 Operators

1. X**Y
2. //
3. -1
4. 3
5. True
6. i, ii, iii, iv, v, vi
7. False
8. Left to Right
9. Addition & Subtraction
10. Parentheses
11. 7
12. **
13. 44
14. (6.0,16.0)
15. 512, 64, 512
16. 8.0
17. False
18. -
19. y
20. error
21. (5,6,7,8) <class ‘tuple’>
22. True
True
23. 13
24. = =
25. or

pg. 21
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

26. and
27. left to right
28. floor division
29. 6 4
30. False
31. =
32. %
33. 5
34. -9.3
35. 2
36. -2
37. +
38. unary
39. arithmetic, relational
40. True
41. True
42. False
43. all
44. eval( )
45. False
46. in, not in
47. is, is not
48. Yes, it will create a new list
49. *
50. 3

pg. 22
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Topic 5 Expressions, Statements, Type conversion & Input/Output

1. How would you write XY in Python as an expression?


a) X**Y b) X*Y c) X^Y d) X/Y

2. What will be the value of the expression? 14 + 13 % 15


a) 14 b) 27 c) 12 d) 0

3. Evaluate A =16, B = 15 if A % B // A
a) 0.0 b) 0 c) 1.0 d) 1

4. What is the value of X? if X = int (13.254 + 2)


a) 17 b) 14 c) 15 d) 23

5. The expression 8 / 4 / 2 will evaluate equivalent to which of the following expression


a) 8 / (4 / 2) b) (8 / 4) / 2 c) both a & b d) none of these

6. What is the value of the following expression? 3 + 3.00, 3**3.0


a) (6.0, 27.0) b) (6.0, 9.00) c) (6, 27) d) (6, 27)

7. What is the average value of the code that is executed below?

a) 85.0 b) 85.1 c) 95.0 d) 95.1

8. What is the return value of trunc?

pg. 23
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) int b) bool c) float d) none of these

9. What is the output of print (0.1 + 0.2 = = 0.3)?


a) True b) False c) Machine Dependent d) Error

10. Select all options that print hello-how-are-you


a) print(“hello”, “how”, “are”, “you”) b) print(“hello”, “how”, “are”, “you”+ ‘-‘ * 4)
c) print(“hello-“ + “how-are-you”) d) print(“hello” + “-“ + “how” + “-“ + “are” + “you”)

11. Which of the following is not a complex number?


a) K = 2 + 3j b) K = complex(2,3) c) K = 2 + 3I d) K = 2 + 3J

12. What is the type of inf?


a) boolean b) integer c) float d) complex

13. What does ~4 evaluate to?


a) -5 b) -4 c) -3 d) +3

14. What does ~ ~ ~ ~ ~ ~5 evaluate to?


a) +5 b) -11 c) +11 d) -5

15. Which of the following is an invalid statements?


a) abc=1,00,000 b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,00,000

16. What is the result of cmp(3,1)?


a) 1 b) 0 c) True d) False

17. What is the result of round(0.5) – round(-0.5)?


a) 1.0 b) 2.0 c) 0.0 d) none
of these

18. Consider the expression given below. The value of X is x = 2 + 9 * ((3*12) – 8 / 10


a) 30.0 b) 30.8 c) 28.4 d) 27.2

pg. 24
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

19. Which is the following expressions involves coercion (implicit conversion) when
evaluated in Python?
a) 4.7 – 1.5 b) 7.9 * 6.3 c) 1.7 % 2 d) 3.4 + 4.6

20. What is the value of the following expression? 24 // 6 % 3, 24 // 4 // 2


a) (1,3) b) (0,3) c) (1,0) d) (3,1)

21. What is the value of expression? float (4 + int (2.39) % 2)


a) 5.0 b) 5 c) 4.0 d) 4

22. The output of the snippet of code shown below?


bool (“False”)
bool( )
a) True b) False c) False d) True
True True False False

23. Predict the output print(“xyyzxyzxzxyy”.count(“yy”,1))


a) 2 b) 0 c) 1 d) error

24. Predict the output print(“xyyzxyzxzxyy”.count(“yy”,2))


a) 2 b) 0 c) 1 d) error

25. Which value type does input( ) function?


a) boolean b) string c) int d) float

26. Which of the following four code fragments will yield following output?
Eina
Mina
Dika
Select all of function calls that result in this output
a) print(“Eina b) print(“Eina c) print(“Eina\nMina\nDika”)
\n Mina Mina
\n Dika”) Dika”)
d) print(“EinaMinaDika”)

pg. 25
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

27. The operator ____ tells if an element is present in a sequence or not.’


a) exists b) in c) into d) inside

28. Which line of code produce an error?


a) “one” + “two” b) 1 + 2 c) “one” + “2” d) “1” + 2

29. Predict the output of the following int (“3” + “4”)


a) “7” b) “34” c) 34 d) 24

30. Predict the output of the following print([Link](-7.9), [Link](7.9))


a) -7 7 b) -8 7 c) 7 -7 d) 7 -8

31. Identify the output


t1 = (2,3,4,5,6)
print([Link](4))
a) 4 b) 5 c) 6 d) 2

32. An ____ is a legal combination of symbols that represents a value.


a) statements b) expressions c) functions d) operators

a+b
33. The equivalent expression in Python for √ a + is _____
b
a) ([Link](a) + a + b) / b b) [Link](a) + (a + b) / b
c) [Link](a) / b + a + b d) [Link](a) / b + (a + b)

34. Python expression for √ x 5∗y 4∗z 3

35. Output of the given expression 2**2**4 is


a) 256 b) 65536 c) 16 d) error

36. Output of print(print((0)))


a) 0 b) None c) 0 d) error
None 0 none

37. Output of the following expression float (22 // 3 + 3 / 3)


a) 8 b) 8.0 c) -8.3 d) 8.333

pg. 26
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

38. What value does the following expression evaluate? 2 + 9 * (( 3 * 12) – 8) / 10


a) 27 b) 27.2 c) 30.8 d) none of these

39. Multiline comments can be done by adding ____ on each end of comment.

40. The expression that requires type conversion when evaluated is _____
a) 4.7 * 6.3 b) 1.7 % 2 c) 3.4 + 4.6 d) 7.9 * 6.3

41. Predict the output of the following expression print(‘new’ ‘line’)


a) error b) ‘new’ c) new line d) newline
‘line’
42. _____ is a combination of operands and operators.
a) expression b) operators c) statements d) none of these

43. Study the following function any([5>8, 6>3, 3>1])


What will be the output of this code?
a) False b) True c) invalid code d) none of these

44. Study the following code >>> print (r”\nPython\ncode”)


What will be the output of this statement?
a) Python b) Python code c) \nPython\ncode d) error
\
45. Study the following code >>> print (0xA + 0xB + 0xC)
What will be the output of this statement?
a) 33 b) 63 c) 0xA + 0xB + 0xC d) error

46. Study the following code >>> print (ord(‘h’) – ord(‘z’))


What will be the output of this statement?
a) 18 b) -18 c) 17 d) -17

47. Study the following program print(True**False/True)


a) True**False/True b) 1.0 c) 1**0/1 d) none of these

pg. 27
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

[Link] the following program. What is the output of the following?


Word = “Python”
print(*Word)
a) Python b) P y t h o n c) *Word d) SyntaxError

49. Study the following program. What is the output of the following?
print(‘It\’s ok, don\’t worry’)
a) It’s ok, don’t worry b) It\’s ok, don\’t worry c) SyntaxError d) ValueError

50. Study the following program


a = ‘1 2’
print(a*2)
print(a*0)
print(a*-2)
a) 1 2 1 2 b) 2 4 c) 0 d) -1 -2 -1 -2

pg. 28
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers :Topic 5 Expressions, Statements, Type conversion & Input/Output

1. X*Y
2. 27
3. 0
4. 15
5. (8 / 4) / 2
6. (6.0, 27.0)
7. 85.0
8. Int
9. False
10. print(“hello-“ + “how-are-you”)
11. K = 2 + 3I
12. float
13. -5
14. +5
15. a b c = 1000 2000 3000
16. 1
17. 2.0
18. 27.2
19. 1.7 % 2
20. (1,3)
21. 4.0
22. True
False
23. 2
24. 1
25. string
26. print(“Eina\nMina\nDika”)
27. in
28. “1” + 2

pg. 29
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

29. 34
30. -7 7
31. 2
32. expressions
33. [Link](a) + (a + b) / b
34. [Link](x**5 + y**4 + z**3)
[Link]([Link](x,5) + [Link](y,4) + [Link](z,3))
35. 65536
36. 0
None
37. 8.0
38. 27.2
39. triple quotes (“ “ “ )
40. 1.7 % 2
41. Newline
42. expression
43. True
44. \nPython\ncode
45. 33
46. -18
47. 1.0
48. P y t h o n
49. It’s ok, don’t worry
50. 1 2 1 2

pg. 30
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Topic 6 Errors

1. What error occurs when you execute? Apple = Mango


a) SyntaxError b) NameError c) ValueError d) TypeError

2. Carefully observe the code and give the

a) Indentation Error b) Cannot perform mathematical operation in strings


c) ‘hello2’ d) ‘hello2hello2’

3. Violation of formal rules of a programming language leads to ______’


a) Syntax Error b) Run-time Error c) Logical Error d) none of these’

4. Consider the code,

a) Syntax Error b) Logical Error c) ZeroDivisionError d) none of these

5. Wrong indentation can give rise to ________


a) Syntax Error b) Run-time Error c) Logical Error d) none of these

pg. 31
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

6. The process of locating and detecting errors in a program is ________


a) running b) debugging c) tracing d) compiling

7. An error that occurs during execution of a program is ______


a) exceptions b) debugging c) compiling d) accessing’

8. _____ is the way in which Python, handles exceptions so as to prevent termination of


script.
a) exception handling b) slicing c) traversing d) accessing

9. What is a bug?

10. What is an except block?

11. ______ error is caused by a mistake in the program’s logic.


a) Syntax b) Run-time c) Logical d) none of these’

12. Output of the following code’


P = (“passengers”, “luggage”)
P[1] = “snakes”

13. Output of the following code a, b, c, d = (1, 2, 3)

14. What error occurs when you execute?


a) Syntax Error b) Name Error c) Value Error d) Type Error

15. What is the value returned by [Link](6)?


a) 720 b) 6 c) [1,2,3,6] d) error

16. The output of the below expression is 10 * (1 / 0)


a) Overflow Error b) ZerodivisionError c) NameError d) Type Error

17. How many except statements can a try-except block have?


a) zero b) one c) more than one d) more than zero

pg. 32
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

18. When will the else part of the try-except -else be executed?
a) always b) when an exception occurs
c) when no exception occurs d) when an exception occurs in a try block

19. When is the finally block executed?


a) When an exception occurs b) When there is no exception
c) Only if some condition that has been specified is satisfied d) always

20. The keyword that is not used as an exception handling in Python?


a) try b) except c) accept d) finally

21. An exception is
a) an object b) a special function c) a special module d) a module

22. A set of statements that will be executed whether an exception is thrown or not?
a) except b) else c) finally d) assert

23. Predict the output of the following code snippet


while True
print(“Hello World”)
a) Syntax Error b) Logical Error c) Run-time Error d) none of these

24. Gauge the output of the following statement? int (“65.43”)


a) Import Error b) Value Error c) Type Error d) Name Error

25. The error that is not a standard exception in Python


a) Name Error b) Assignment Error c) IO Error d) Value Error

26. What will be the output of the following code?


L = [1, 2, 3]
L[3] = 4
a) NameError b) ValueError c) IndexError d) TypeError

27. What will the output of the following code, if the time module has already been imported?
4 + ‘3’

pg. 33
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) NameError b) ValueError c) IndexError d) TypeError

28. Compare the following two Python codes shown below and state the output if the input
entered in each case is -6?
Code1
import math
n = int(input(“Enter a number”))
print([Link](n))
Code 2
n = int(input(“Enter a number”))
print([Link](n))
a) ValueError, NameError b) AttributeError, ValueError
c) NameError, TypeError d) TypeError, ValueError

29. Syntax errors are also known as ________ errors.

30. What happens when ‘2’ = = 2 is executed?


a) True b) False c) ValueError d) TypeError

31. In the Python programming language, syntax error is detected by ___ at ____.
a) Interpreter/compile time b) Run time/Interpreter
c) Interpreter/Runtime d) compile time/run time

pg. 34
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers : Topic 6 Errors

1. NameError
2. ‘hello2hello2’
3. Syntax Error
4. ZeroDivisionError
5. Syntax Error
6. Debugging
7. Exceptions
8. exception handling
9. A bug is an error in code.
10. It handles an exception i.e. this set of code is executed if an exception occurs.
11. Logical
12. TypeError ‘tuple’ object does not support item assignment.
13. ValueError not enough values to unpack (expected 4, got 3)
14. Name Error
15. error [NameError]
16. ZerodivisionError
17. more than zero

pg. 35
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

18. when no exception occurs


19. always
20. accept
21. an object
22. finally
23. Syntax Error
24. Value Error
25. Assignment Error
26. IndexError
27. TypeError
28. ValueError, NameError
29. Parsing
30. False
31. Interpreter/Runtime

Topic 7 Flow of control

1. Predict the output of the following code

a) False b) True c) False d) True


True True False False

2. A loop that contains another loop inside its body is called ___________

3. In Python, an empty statement is ______ statement.


a) pass b) none c) empty d) none of these

4. Which of the following is a valid keyword?


a) If b) IF c) if d) none of these

5. Predict the output of the following code

pg. 36
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) 101 b) 202 c) 101 202 d) error

6. Indentation while working with blocks is not necessary in Python (True / False)
a) True b) False c) Machine dependent d) none of these

7. else if can be used in Python.


a) True b) False c) Machine dependent d) none of these

8. Write logical expression for the following


place is either “Delhi” or “Goa” but not “Jaipur”

9. Write logical expression for the following


Name is “Vivek” and age is between 18 and 35

10. Predict the output of the following code

11. Predict the output of the following code

12. Predict the output of the following code

13. The logical expression to represent mark is greater than or equal to 100 but less than 70
a) mark>=100 b) mark>=100 and mark<70 c) mark>=100and mark>70 d) none

pg. 37
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

14. ______ is the order of execution of various statements written in a program.


a) execution b) flow of control c) condition d) none of these

15. Identify the output of the following code

16. Predict the output for the following code

a) vellous and Ma b) vellous and lo c) vellous and M d) vellous and

17. The symbol that is placed at the end of if condition is _____


a) ; b) : c) & d) –

18. What will be the output after the following statements?

a) 20 b) 30 c) 10 d) 40

19. What will be the output after the following statements?

a) 15 b) yes c) equal d) no

pg. 38
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

20. What will be the output after the following statements?

a) true b) false c) not true d) not false

21. What will be the output after the following statements?

a) true b) false c) not true d) not false

22. What will be the output after the following statements?

a) None b) absolute value c) wrong value d) error

23. What will be the output after the following statements?

a) No output b) error c) 0 d) -3

24. What will be the output after the following statements?

a) None b) yes c) no d) 0

pg. 39
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

25. What will be the output after the following statements?

a) None b) yes c) no d) 0

26. What will be the output after the following statements?

a) None b) yes c) no d) 0

27. Which one of the following is a valid python if statement


a) if a >= 2 b) if (a >= 2) c) if (a => 22) d) if a >= 22

28. What keyword would you use to add an alternative condition to an if statement?
a) else if b) elseif c) elif d) none of these

29. Can we write if/else into one line in Python?


a) yes b) no c) if/else not used in python d) none of these

30. Does Python have switch case statement?


a) True b) False
c) Python has switch statement but we cannot use it d) none of these

pg. 40
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

Answers : Topic 7 Flow of control

1. False
True
2. nested loop
3. pass
4. if
5. 101
6. False
7. False
8. (place = = “Delhi” or place = = “Goa”) and place ! = “Jaipur”
9. Name = = “Vivek” and age> = 18 and age < = 35
10. OK
11. 11 13 15 17 19
12. 8
6

pg. 41
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

10
13. mark>=100 and mark<70
14. flow of control
15. ok
average
16. vellous and Ma
17. :
18. 20
19. no
20. not false
21. false
22. absolute value
23. 0
24. yes
25. no
26. yes
27. if a >= 2
28. elif
29. yes
30. False

Topic 8 Conditional Statements

1. Predict the output of the following code

2. Predict the output of the following code

3. Identify the output of the given code

4. A loop that contains another loop inside its body is called __________
a) endless loop b) infinite loop c) nested loop d) none of these

pg. 42
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

5. Predict the output of the following code

6. Predict the output of the following code

7. The _______ function of Python generates a list which is a special sequence type.

8. ________ statement skis the rest of the loop and jumps over to the statement following the
loop.
a) break b) continue c) both d) none of these

9. Use the Python range( ) function to create the following list [ 7, 3, -1, 5]

10. Rewrite the given while loop using for loop

11. Rewrite the following code using while loop

12. Write the output of the following code

13. How many times will the following code be executed?

a) 5 times b) once c) infinite d) none of these

14. Predict the output of the following code

pg. 43
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

15. Find error(s) in the following code

16. Write the output of the following code

17. Predict the output of the following code

18. Write the output of the following code

19. Predict the output of the following code

a) [‘AB’, ‘CD’] b) [‘ab’,’cd’,’AB’,’CD’] c) [‘ab’, ‘cd’] d) no output

20. Predict the output of the following code

a) True b) False c) None d) error

21. Identify the output of the following code

pg. 44
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) abcdef b) iiiiii……… c) iiiiii d) error

22. Predict the output of the following code

a) No output b) iiiiii…….. c) a b c d e f d) abcdef

23. Identify the output of the following code

a) a b) abcdabcdabcd c) a aaa d) none of these

24. Identify the output of the following code

a) a b) abcdabcdabcd c) a aaa d) none of these

25. Predict the output of the following code

a) 0 b) no output c) error d) none of these

26. Predict the output of the following code

a) 0.0 1.0 b) 0 1 c) error d) none of these

27. Predict the output of the following code

pg. 45
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

a) 0.0 1.0 b) 0 1 c) error d) none of these

28. Predict the output of the following code

a) 0 1 2 b) error c) 012 012 d) none of these

29. Predict the output of the following code

a) m,y, ,n,a,m,e, ,i,s, ,X,X,X, b) m,y, ,n,a,m,e, ,i,s, ,X,X,X


c) my, name, is, XXX, d) error

30. How many times will the following loop be executed?

a) 15 times b) 16 times c) 17 times d) 18 times

31. Identify the output of the following code

a) 0 1 2 3 b) 0 1 2 2 c) 3 3 3 3 d) error

32. Predict the output of the following code

a) m,y, ,n,a,m,e, ,i,s, ,X,X,X, b) m,y, ,n,a,m,e, ,i,s, ,X,X,X


c) my, name, is, XXX, d) error

33. How many times is the word “Hello” printed?

a) 4 times b) 5 times c) 6 times d) 7 times

pg. 46
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

34. What abandons the current iteration of the loop?


a) continue b) break c) stop d) infinite

35. How many times will the following code is executed?

a) 5 times b) once c) infinite d) none of these

36. Predict the output of the following code

37. Counting loop in Python is __________


a) for b) while c) if d) if-elif

38. Conditional loop in Python is ______


a) for b) while c) if d) if-elif

39. By default, then range of values in for loop starts from ____ in every iteration.
a) – 1 b) 0 c) 1 d) none of these

40. _______ is a null operation.


a) break b) continue c) pass d) jump

41. Predict the output of the following code

42. Predict the output of the following code

pg. 47
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

43. What are the correct ways to generate numbers from 0 to 20?
a) range(20) b) range(0,21) c) range(21) d) range(0,20)

44. Convert the following using while loop

45. Identify the output of the following code

46. Identify the output of the following code

47. Identify the output of the following code

48. Write the output of the following code

pg. 48
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

49. Identify the output of the following code

50. Identify the output of the following code

a) 1 1 2 2 b) 1 1 2 2 3 3 4 4 c) 1 2 3 4 d) 1 2 1 2 1 2

Answers : Topic 8 Conditional Statements

1. -500 -400 -300 -200 -100 0 100 200 300 400


2. 100*90*80*70*60*
3. Infinite loop
4. nested loop
5. 500 * 400 * 300 * 200
6.

pg. 49
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

7. range( )
8. break
9. range(7, -6, -4)
10.

11.

12. no output
13. infinite
14. 1 2 3 4
15.

16. 6 2
17. -100 * 0 * 100
18.

19. no output
20. error
21. error
22. No output
23. a aaa
24. none of these
25. no output
26. error
27. 0 1
28. 0 1 2
29. m,y, ,n,a,m,e, ,i,s, ,X,X,X,
30. 17 times
31. 0 1 2 2
32. my,name,is,XXX,
33. 5 times
34. continue
35. infinite
36.

pg. 50
Vivekananda Educational Society
MCQ Study material – Computer Science – Class XI
Unit II Computational Thinking and Programming - I (Python)

37. for
38. while
39. 0
40. pass
41. 6 6 6 6 6 6 6 6 6 6 6
42. 26 45
43. range(0,21)& range(21)
44.

45. 1,3,5,7,9,11,
46. 1,2,3,4,5,
47.
48.
49.

50. 1 2 1 2 1 2

pg. 51

You might also like