[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

2 / 40

2. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

3 / 40

3.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

4 / 40

4. What will be the output of the following Python code?

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

5 / 40

5.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

6 / 40

6. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

7 / 40

7. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

8 / 40

8. You can also use the remove() method to remove an element from the array

9 / 40

9. Python can be used to handle big data and perform complex mathematics.

10 / 40

10. Pip is  not a powerful package management system for Python software packages

11 / 40

11. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

12 / 40

12. Python is a  high-level programming language.

13 / 40

13. The length of an array is always one more than the highest array index.

14 / 40

14. Arithmetic operators are used with numeric values to perform common mathematical operations

15 / 40

15. What will be the output of the following Python code?

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

16 / 40

16. Variable names are case-sensitive

17 / 40

17.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

18 / 40

18. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

19 / 40

19. Extension of all Python  Programme are .py

20 / 40

20. A variable name cannot start with a number

21 / 40

21. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

22 / 40

22.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

23 / 40

23.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

24 / 40

24. You can also have an else without the elif

25 / 40

25. What will be the output of the following Python code?

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

26 / 40

26.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

27 / 40

27. The format() method takes unlimited number of arguments

28 / 40

28. Bitwise operators are used to compare (binary) numbers

29 / 40

29.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

30 / 40

30. print() function is often used to output variables.

31 / 40

31. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

32 / 40

32.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

33 / 40

33. Comparison operators are not  used to compare two values

34 / 40

34.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

35 / 40

35. We can combine strings and numbers by using the format() method

36 / 40

36. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

37 / 40

37. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

38 / 40

38.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

39 / 40

39. Operators are used to perform operations on variables and values

40 / 40

40. Most recent major version of Python is Python 3

Exit



[hurrytimer id=”2250″]
[wooct_product]

Wrong shortcode initialized


You must log in to see your results.



Wrong shortcode initialized


There are no questions atteched yet.





[ays_quiz_leaderboard id=”Your_Quiz_ID” from=”Y-m-d H:i:sa” to=”Y-m-d H:i:s”]

Category:


Wrong shortcode initialized


[WATU 1]

You must log in to see your results.