[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. Python can be used to handle big data and perform complex mathematics.

3 / 40

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

 

4 / 40

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

5 / 40

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

6 / 40

6.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

7 / 40

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

8 / 40

8. Python can connect to database systems.

9 / 40

9. Variable names are case-sensitive

10 / 40

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

11 / 40

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

12 / 40

12. Comments can be used to explain Python code.

13 / 40

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

14 / 40

14. print() function is often used to output variables.

15 / 40

15. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

16 / 40

16.

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

a. 2

b. 3

c. 5

d. Multiple times

17 / 40

17. Is there any comments in  following codes

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

 

18 / 40

18.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

19 / 40

19.

Which is the correct operator for power(xy)?

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

20 / 40

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

21 / 40

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

22 / 40

22.

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

a. Define

b. DEF

c. def

d. Def

23 / 40

23.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

24 / 40

24.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

25 / 40

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

26 / 40

26.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

27 / 40

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

28 / 40

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

29 / 40

29.

What will be the output of below Python code?

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

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

30 / 40

30. Comments starts with a #

31 / 40

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

32 / 40

32. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

33 / 40

33. You can also use the remove() method to remove an element from the array

34 / 40

34. An array can hold many values under a single name

35 / 40

35.

How to copy one list to another in python?

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

36 / 40

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

37 / 40

37. Variables that are created outside of a function

38 / 40

38. A variable name cannot start with a number

39 / 40

39.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

40 / 40

40. Python relies on indentation?

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.