[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

2 / 40

2. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

3 / 40

3.

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

a. 2

b. 3

c. 5

d. Multiple times

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

7. Variable names are case-sensitive

8 / 40

8. The format() method takes the passed arguments

9 / 40

9. python file can also run on command line

10 / 40

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

11 / 40

11.

What will be the output of below Python code?

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

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

12 / 40

12. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

13 / 40

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

14 / 40

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

15 / 40

15.

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

a. [ ]

b. { }

c. ( )

d. None of the above

16 / 40

16. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

17 / 40

17.

What is the value of the expression 100 / 25?

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

18 / 40

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

19 / 40

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

20 / 40

20. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

21 / 40

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

22 / 40

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

23 / 40

23. Python can be install on both  Linux and  Windows

24 / 40

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

25 / 40

25.

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

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

26 / 40

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

27 / 40

27.

What will be the output of below Python code?

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

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

28 / 40

28.

 ____________________ 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

29 / 40

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

30 / 40

30. Is there any comments in  following codes

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

 

31 / 40

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

32 / 40

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

33 / 40

33. Python allows you to extract the values into variables.

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

37. Python can connect to database systems.

38 / 40

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

39 / 40

39.

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

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

40 / 40

40. Python is a  high-level programming language.

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.