[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

4 / 40

4. During Installation Make sure to select both the checkboxes at the bottom .

5 / 40

5. Python can connect to database systems.

6 / 40

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

7 / 40

7. Pascal Case
Each word starts with a capital letter:

8 / 40

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

9 / 40

9. With the break statement we can stop the loop before it has looped through all the items

10 / 40

10. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

15. Python has various versions available

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

What will be the output of below Python code?

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

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

20 / 40

20. Comments starts with a #

21 / 40

21.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

22 / 40

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

23 / 40

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

24 / 40

24.

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

a. Define

b. DEF

c. def

d. Def

25 / 40

25. Python  was created by Guido van Rossum, and released in 1999.

26 / 40

26. Python is an interpreted programming language

27 / 40

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

 

28 / 40

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

29 / 40

29. Python allows you to extract the values into variables.

30 / 40

30.

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.

31 / 40

31.

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

a. [ ]

b. { }

c. ( )

d. None of the above

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. The for loop does not require an indexing variable to set beforehand

34 / 40

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

35 / 40

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

36 / 40

36. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

37 / 40

37. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

38 / 40

38.

 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.

39 / 40

39.

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

40 / 40

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

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.