[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Comments can be used to explain Python code.

2 / 40

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

3 / 40

3. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

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

4 / 40

4. python has two primitive loop commands:

  • while loops
  • for loops

5 / 40

5.

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.

6 / 40

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

7 / 40

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

8 / 40

8.

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

a. True

b. False

9 / 40

9.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

10 / 40

10.

What will be the output of below Python code?

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

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

11 / 40

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

12 / 40

12. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

13 / 40

13. Is there any comments in  following codes

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

 

14 / 40

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

15 / 40

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

16 / 40

16. Python relies on indentation?

17 / 40

17. A variable name cannot start with a number

18 / 40

18.

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

19 / 40

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

20 / 40

20.

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.

21 / 40

21. Variables that are created outside of a function

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

25. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

26 / 40

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

27 / 40

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

28 / 40

28.

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

a. Define

b. DEF

c. def

d. Def

29 / 40

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

30 / 40

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

31 / 40

31.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

32 / 40

32. The for loop does not require an indexing variable to set beforehand

33 / 40

33. To insert characters that are illegal in a string, use an escape character

34 / 40

34.

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

35 / 40

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

36 / 40

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

37 / 40

37.

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

a. 2

b. 3

c. 5

d. Multiple times

38 / 40

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

39 / 40

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

40 / 40

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

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.