[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

2 / 40

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

3 / 40

3. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

4 / 40

4.

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

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

5 / 40

5. Snake Case
Each word is separated by an underscore character:

6 / 40

6.

Which is the correct operator for power(xy)?

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

7 / 40

7. Python has a set of built-in methods that you can use on lists/arrays

8 / 40

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

9 / 40

9. You can return a range of characters by using the slice syntax

10 / 40

10. Variables that are created outside of a function

11 / 40

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

12 / 40

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

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.

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

15 / 40

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

16 / 40

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

17 / 40

17. Python can be treated in a procedural way, an object-oriented way or a functional way.

18 / 40

18. A variable name must start with a letter or the underscore character

19 / 40

19.

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

20 / 40

20. 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()

 

21 / 40

21.

What will be the output of above Python code?

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

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

22 / 40

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

23 / 40

23.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

24 / 40

24. You can also have an else without the elif

25 / 40

25. Camel Case
Each word, except the first, starts with a capital letter:

26 / 40

26. Python is a  high-level programming language.

27 / 40

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

28 / 40

28.

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

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

29 / 40

29. + operator is used  to get output of multiple variables

30 / 40

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

31 / 40

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

32 / 40

32.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

33 / 40

33. An array can hold many values under a single name

34 / 40

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

35 / 40

35.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

36 / 40

36.

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

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

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.