[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

2 / 40

2. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

3 / 40

3.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

4 / 40

4.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

5 / 40

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

6 / 40

6. You can have if statements inside if statements, this is called nested if statements.

7 / 40

7.

In the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

8 / 40

8. Comments can be used to explain Python code.

9 / 40

9.

Which is the correct operator for power(xy)?

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

10 / 40

10.

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

a. 2

b. 3

c. 5

d. Multiple times

11 / 40

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

12 / 40

12.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

13 / 40

13.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

14 / 40

14. Most recent major version of Python is Python 3

15 / 40

15. Indentation refers to the spaces at the beginning of a code line.

16 / 40

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

17 / 40

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

18 / 40

18.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

19 / 40

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

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. Python can be treated in a procedural way, an object-oriented way or a functional way.

22 / 40

22. Python has various versions available

23 / 40

23.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

24 / 40

24. Variable names are case-sensitive

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

31. python file can also run on command line

32 / 40

32. An array is a special variable, which can hold more than one value at a time

33 / 40

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

34 / 40

34. Python can be install on both  Linux and  Windows

35 / 40

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

36 / 40

36. Official site of python is www.python.org

37 / 40

37.

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

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. Snake Case
Each word is separated by an underscore character:

40 / 40

40.

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

a. True

b. False

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.