[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

a. [ ]

b. { }

c. ( )

d. None of the above

3 / 40

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

4 / 40

4. Most recent major version of Python is Python 3

5 / 40

5.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

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. You can also use the remove() method to remove an element from the array

8 / 40

8. Variable names are case-sensitive

9 / 40

9. python file can also run on command line

10 / 40

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

11 / 40

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

12 / 40

12.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

13 / 40

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

14 / 40

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

15 / 40

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

 

16 / 40

16.

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

a. 2

b. 3

c. 5

d. Multiple times

17 / 40

17.

Which is the correct operator for power(xy)?

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

18 / 40

18.

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23. Comparison operators are not  used to compare two values

24 / 40

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

25 / 40

25. The format() method takes the passed arguments

26 / 40

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

27 / 40

27. python has two primitive loop commands:

  • while loops
  • for loops

28 / 40

28. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

29 / 40

29. Arrays are used to store multiple values in one single variable.

30 / 40

30.

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

31 / 40

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

32 / 40

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

33 / 40

33.

 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.

34 / 40

34.

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

35 / 40

35.

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.

36 / 40

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

37 / 40

37. Which of the following is the correct extension of the Python file?

38 / 40

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

39 / 40

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

40 / 40

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

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.