[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

2 / 40

2. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

3 / 40

3. You can also have an else without the elif

4 / 40

4. What is the output of the given below program?

if 3 + 4 == 7:    print("Hi")else:    print("Know Program")print("Hello")

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

5 / 40

5. 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

6 / 40

6. 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))

7 / 40

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

8 / 40

8. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

9 / 40

9. Python will give you an error if you skip the indentation

10 / 40

10.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

11 / 40

11.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

12 / 40

12. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

13 / 40

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

14 / 40

14. Strings in python are surrounded by either single quotation marks, or double quotation marks

15 / 40

15.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

16 / 40

16. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

17 / 40

17.

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.

18 / 40

18. The list’s remove() method only removes the first occurrence of the specified value.

19 / 40

19. Comments starts with a #

20 / 40

20. Comments can’t be used to prevent execution when testing code.

21 / 40

21. The len() method to return the length of an array

22 / 40

22. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

23 / 40

23. 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

24 / 40

24. Python can be used on a server to create web applications?

25 / 40

25.

What is the data type of print(type(10))

26 / 40

26.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

27 / 40

27. python file can also run on command line

28 / 40

28. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

29 / 40

29.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

30 / 40

30.

What will be the output of above Python code?

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

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

31 / 40

31. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

32 / 40

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

33 / 40

33. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

34 / 40

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

35 / 40

35.

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

a. True

b. False

36 / 40

36. With the for loop we can execute a set of statements

37 / 40

37. A variable name cannot start with a number

38 / 40

38. To write and execute code in python, we first need to install Python on our system.

39 / 40

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

40 / 40

40. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

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.