[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. You can also have multiple else statements on the same line:

3 / 40

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

4 / 40

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

5 / 40

5. Python is a  high-level programming language.

6 / 40

6. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

7 / 40

7. Who developed Python Programming Language?

8 / 40

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

9 / 40

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

10 / 40

10.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

14.

 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.

15 / 40

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

16 / 40

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

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. The format() method takes the passed arguments

19 / 40

19. Python has various versions available

20 / 40

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

21 / 40

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

22 / 40

22.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

23 / 40

23.

Which function overloads the >> operator?

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

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

29 / 40

29.

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

30 / 40

30.

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

31 / 40

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

32 / 40

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

33 / 40

33.

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

34 / 40

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

35 / 40

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

 

36 / 40

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

37 / 40

37. You can use the append() method to add an element to an array

38 / 40

38.

Which is the correct operator for power(xy)?

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

39 / 40

39. Comments starts with a #

40 / 40

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

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.