[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

What will be the output of below Python code?

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

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

3 / 40

3.

What is the value of the expression 100 / 25?

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

4 / 40

4. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

5 / 40

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

6 / 40

6. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

7 / 40

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

8 / 40

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

9 / 40

9. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

10 / 40

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

11 / 40

11. What will be the output of the following Python code?

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

12 / 40

12. The length of an array is always one more than the highest array index.

13 / 40

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

14 / 40

14. Python has various versions available

15 / 40

15.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

16 / 40

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

17 / 40

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

18 / 40

18.

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

19 / 40

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

20 / 40

20.

Which function overloads the >> operator?

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

21 / 40

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

22 / 40

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

23 / 40

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

 

24 / 40

24. Comments can’t be used to prevent execution when testing code.

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

28. Python can be used on a server to create web applications?

29 / 40

29.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

30 / 40

30.

 Select the correct example of complex datatype in Python

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

31 / 40

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

32 / 40

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

33 / 40

33.

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

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

34 / 40

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

35 / 40

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

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. Python is an interpreted programming language

38 / 40

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

39 / 40

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

40 / 40

40.

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

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.