0% found this document useful (0 votes)
142 views

Python Test 3 Objective

The document contains multiple choice questions about Python concepts like data types, operators, functions, classes, and more. It tests knowledge of topics like the id() function returning the identity of an object, Python being case sensitive, the class keyword marking the start of a class definition, parentheses having highest precedence in expressions, tuples being immutable unlike lists, and other core Python ideas.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views

Python Test 3 Objective

The document contains multiple choice questions about Python concepts like data types, operators, functions, classes, and more. It tests knowledge of topics like the id() function returning the identity of an object, Python being case sensitive, the class keyword marking the start of a class definition, parentheses having highest precedence in expressions, tuples being immutable unlike lists, and other core Python ideas.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Which of the following is the use of id() function in python?

a) Every object doesn’t have a unique id


b) Id returns the identity of the object
c) All of the mentioned
d) None of the mentioned

2. Is Python case sensitive when dealing with identifiers?

a) yes
b) no

3. All keywords in Python are in

a) UPPER CASE
b) lower case
c) Capitalized
d) None of the mentioned

4. Mathematical operations can be performed on a string. State whether true or false -

a) False
b) True

5. Which one of the following has the highest precedence in the expression?

a) Addition
b) Multiplication
c) Exponential
d) Parentheses

6. What is the return type of function id?

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

7. What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))

a) Hello ‘foo’ and foo


b) Hello foo and foo
c) Hello foo and ‘bin’
d) Error

8. Which of the following data types is not supported in python ?

a) String
b) Numbers
c) Slice
d) List
9. Which Of The Following Keywords Mark The Beginning Of The Class Definition?

a) return
b) class
c) def
d) All of the above

10. Select the reserved keyword in python-

a) else
b) raise
c) import
d) All of the above

11. Are nested if-else are allowed in Python?

a) Yes
b) no

12. Python allows string slicing. What is the output of below code: s='cppbuzz chicago' print(s[3:5])

a) buzzc
b) pbuzz
c) bu
d) None of these

13. class test: def __init__(self): print "Hello World" def __init__(self): print "Bye World" obj=test()

a) Bye World
b) Hello World
c) Compilation Error
d) Ambiguity

14. The format function, when applied on a string returns :

a) list
b) bool
c) int
d) str

15. Which statement is correct....??

a) List is mutable && Tuple is immutable


b) List is immutable && Tuple is mutable
c) Both are Mutable.
d) Both are Immutable

16. What is the maximum possible length of an identifier?

a) 32 characters
b) 63 characters
c) 79 characters
d) None of the above
17. Which one of the following is not a python's predefined data type?

a) List
b) Dictionary
c) Tuple
d) Class

18. What will be the output of 7^10 in python?

a) 13
b) 15
c) 2
d) None of these

19. 19 % 2 in python

a) 2
b) 17
c) None of these

20. Which of the following has more precedance?

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

21. Is Tuple mutable?

a) yes
b) no

1b 2a 3 d 4 a 5 d 6 d 7 b 8 c 9 b 10 d
11 a 12 c 13 a 14 d 15 a 16 d 17 d 18 a 19 c 20 c
21 b

You might also like