[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. The format() method takes the passed arguments

3 / 40

3.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

4 / 40

4. A variable name can only contain alpha-numeric characters and
underscores

5 / 40

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

6 / 40

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

7 / 40

7.

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

8 / 40

8. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

9 / 40

9.

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

10 / 40

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

11 / 40

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

12 / 40

12.

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

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

13 / 40

13. Variables that are created outside of a function

14 / 40

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

15 / 40

15.

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

a. 2

b. 3

c. 5

d. Multiple times

16 / 40

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

17 / 40

17.

 ____________________ 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

18 / 40

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

19 / 40

19. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

20 / 40

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

21 / 40

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

22 / 40

22.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

23 / 40

23. Python is a  high-level programming language.

24 / 40

24. Variable names are case-sensitive

25 / 40

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

26 / 40

26.

What will be the output of below Python code?

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

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

27 / 40

27.

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

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

28 / 40

28.

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

a. [ ]

b. { }

c. ( )

d. None of the above

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

32. Comments can be used to explain Python code.

33 / 40

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

34 / 40

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

35 / 40

35. python file can also run on command line

36 / 40

36. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

37 / 40

37.

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

38 / 40

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

39 / 40

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

40 / 40

40. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

a) Hello
b) Know Program
c) Compiled Successfully, No Output.
d) Error

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.