[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

2 / 40

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

3 / 40

3. You can also have multiple else statements on the same line:

4 / 40

4. With the break statement we can stop the loop even if the while condition is true

5 / 40

5. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

9.

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

10 / 40

10. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

11 / 40

11. A variable name can only contain alpha-numeric characters and
underscores

12 / 40

12. Comments can be used to make the code more readable.

13 / 40

13.

Which is the correct operator for power(xy)?

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

14 / 40

14. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

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. You can also have an else without the elif

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23. Comments starts with a #

24 / 40

24.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

25 / 40

25. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

26 / 40

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

27 / 40

27.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

28 / 40

28. Python relies on indentation?

29 / 40

29.

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

30 / 40

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

31 / 40

31.

 ____________________ 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

32 / 40

32. Extension of all Python  Programme are .py

33 / 40

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

34 / 40

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

35 / 40

35.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

36 / 40

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

37 / 40

37.

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

38 / 40

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

39 / 40

39. Most recent major version of Python is Python 3

40 / 40

40.

What will be the output of above Python code?

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

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

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.