What is the output of the code

Assignment Help Other Subject
Reference no: EM132584941

Questions -

Q1. What is the output of the following code?

example = "snow world"

example[3] = 's'

print example

A. snow

B. snow world 

C. Error

D. snos world

Q2. What is the output of "hello"+1+2+3 ?

A. hello123

B. hello

C. Error

D. hello6

Q3. What will be the output of the following Python statement?

"abcd"[2:]

A. Cd

B. ab

C. a

D. dc

Q4. The output of executing string.ascii_letters can Also be achieved by:

A. string.ascii_lowercase_string.digits

B. string.ascii_lowercase+string.ascii_upercase

C. string.letters

D. string.lowercase_string.upercase

Q5. What will be the output of the following Python code

str1 = 'hello'

str2 = ','

str3 = 'world'

Str1[-1:]

A. olleh

B. hello

C. h

D. o

Q6. What will be the output of the following Python statement?

>>> print('x\97\x98')

A. Error

B. 97

98

C. x\97

D. \x97\x98

Q7. Which of the following will result in an error?

str1=""python""

A. print(str1[2])

B. str1[1]="x"

C. print(str1[0:9])

D. Both (b) and (c)

Q8. Which of the following is False?

A. capitalize() function in string is used to return a string by Converting the whole given string into uppercase.

B. lower() function in string is used to return a string by converting The whole given string into lowercase.

C. String is immutable

D. None of these.

Q9. What will be the output of below Python code?

str1="Information"

print(str1[2:8])

A. format

B. formatio

C. orma

D. ormat

A. format

B. formatio

C. orma

D. ormat

Q10. What will be the output of below Python code?

str1="Aplication"

str2=str1.replace('a','A')

print(str2)

A. Application

B. Application

C. ApplicAtion

D. applicAtion

Q11. What will be the output of below Python code?

str1="poWer"

str1.upper()

print(str1)

A. POWER

B. Power

C. power

D. POWer

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

Q13. list1=[0,2,5,1]

str1=""7""

for i in list1:

str1=str1+i

print(str1)

A. 70251

B. 7

C. 15

D. Error

Q14. Which of the following will give "Simon" as output?

If str1="John,Simon,Aryan"

A. print(str1[-7:-12])

B. print(str1[-11:-7])

C. print(str1[-11:-6])

D. print(str1[-7:-11])

Q15. What will following Python code return?

str1="Stack of books"

print(len(str1))

A. 13

B. 14

C. 15

D. 16

Q16. What is the output of the following string operations

str = "My salary is 7000";

print(str.isalnum())

A. True

B. FALSE

C. Error

D. OK

Q17. Guess the correct output of the following code?

str1 = "PYnative"

print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1])

A. PYn PYnat ive PYnativ vitanYP

B. Yna PYnat tive PYnativ vitanYP

C. Yna PYnat tive PYnativ Pynativ

D. Error

Q18. Select the correct output of the following String operations

myString = "pynative"

stringList = ["abc", "pynative", "xyz"]

print(stringList[1] == myString)

print(stringList[1] is myString)

A. true false

B. true true

C. FALSE

D. TRUE

Q19. Which method should I use to convert String

"welcome to the beautiful world of python" to

"Welcome To The Beautiful World of Python"

A. capitalize()

B. title()

C. togglecase()

Q20. Python does not support a character type;

A single character is treated as strings of length one.

A. FALSE

B. TRUE

Q21. Select the correct output of the following String operations

str1 = "my isname isisis jameis isis bond";

sub = "is";

print(str1.count(sub, 4))

A. 5

B. 6

C. 7

D. 8

Q22. What is the output of the following code

str1 = "My salary is 7000";

str2 = "7000"

print(str1.isdigit())

print(str2.isdigit())

A. False

True

B. False

False

C. TRUE

D. FALSE

Q23. Select the correct output of the following String operations

str = "my name is James bond";

print (str.capitalize())

A. My Name Is James Bond

B. TypeError: unsupported operand type(s) For * or pow(): 'str' and 'int'

C. My name is james bond

D. Error

Q24. Select the correct output of the following String operations

str1 = 'Welcome'

print (str1[:6] + ' PYnative')

A. Welcome Pynative

B. WelcomPYnative

C. Welcom Pynative

D. WelcomePYnative

Q25. Guess the correct output of the following String operations

str1 = 'Welcome'

print(str1*2)

A. TypeError: unsupported operand type(s) For * or pow(): 'str' and 'int'

B. WelcomeWelcome

C. Welcome2

D. 2welcome

Q26. Choose the correct function to get the ASCII code of a character

A. char('char')

B. ord('char')

C. ascii('char'

D. none

Q27. What is the output of the following string comparison

print("John" > "Jhon")

print("Emma" < "Emm")

A. True

False

B. False

False

C. TRUE

D. FALSE

28. What is the output of the following?

print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12))

A. The sum of 2 and 10 is 12

B. The sum of 10 and a is 14

C. The sum of 10 and a is c

D. Error

Q29. used to know whether a string is ending with a substring or not.

A. ends_with()

B. end_with()

C. endswith()

D. None of these.

Q30. What will be the output of the following Python code snippet?

print('for'.isidentifier())

A. TRUE

B. FALSE

C. None

D. ERROR

Q31. What will be the output of the following Python code snippet?

print('a@ 1,'.islower())

A. TRUE

B. FALSE

C. None

D. ERROR

32. What will be the output of the following Python code snippet?

print('11'.isnumeric())

A. TRUE

B. FALSE

C. None

D. ERROR

Q33. What will be the output of the following Python code snippet?

print('''''.isspace())

A. TRUE

B. FALSE

C. None

D. ERROR

Q34. What will be the output of the following Python code snippet?

print('HelloWorld'.istitle())

A. FALSE

B. TRUE

C. ERROR

D. None

Q35. What will be the output of the following Python code?

print('''\tfoo'''.lstrip())

A. \tfoo

B. foo

C. foo

D. none of the mentioned

Q36. What will be the output of the following Python code?

print('xyxxyyzxxy'.lstrip('xyy'))

A. zxxy

B. xyxxyyzxxy

C. xyxzxxy

D. none of the mentioned

Q37. What will be the output of the following Python code?

print('{0:.2}'.format(1/3))

A. 0.333333

B. 0.33

C. 0.333333:.2

D. Error

Q38. What will be the output of the following Python code?

print('Hello!2@#World'.istitle())

A. None

B. error

C. TRUE

D. FALSE

Q39. What will be the output of the following Python code?

print('1Rn@'.lower())

A. n

B. 1rn@

C. rn

D. r

Q40. To check string is equal ornot which operator we use?

A. a=b

B. a==b

C. a<b

D. a<b

Reference no: EM132584941

Questions Cloud

Describe the scope of your project : Describe the scope of your project. Develop a high-level work breakdown structure for your project.
What is the combination on hand : What is the combination on hand, building, land owned, equipment, investments expected income. Classified as short-term and long-term
Define currently emerging healthcare technology system : Include introduction, a currently emerging healthcare technology system, goals for the product, data supporting the product, healthcare settings.
Compute for the income tax expense recognised : ABC Co. financial reporting year ends June 30 and reports quarterly,Compute for the income tax expense recognised in the quarterly interim financial statements.
What is the output of the code : What is the output of the following code? The output of executing string.ascii_letters can Also be achieved by
Create short summary critically evaluating the debate for : Create short summary critically evaluating the debate for and against an international conceptual framework and international accounting standards.
Describe the current prescribed rate of cannabis : Trace the history of cannabis use in medicine for the treatment and management of illness via nursing scholarly journal articles. Examine your sources for the.
Solve the gross margin for target corporation : Solve the gross margin for Target Corporation. Utilize the 2017 financial statements, annual reports, horizontal and vertical analysis
Critical aspects of employees responsibilities : Discussion of Three Critical Aspects of Employee's responsibilities - Discussion of Employee Specific Critical Responsibility - Critical Aspects of Employees

Reviews

Write a Review

Other Subject Questions & Answers

  MS6LS52O Strategic Management Assignment

MS6LS52O Strategic Management Assignment Help and Solution - University of West London, UK. Individual Strategic Management Report

  Would such an agreement improve utility

Suppose Mr. and Mrs. Ward agreed not to vote in tomorrow's election. Would such an agreement improve utility? Would such an agreement be an equilibrium?

  Why are crime rates still increasing in the us

The two disciplines I am intertwining is: Criminal Justice and Government.The title for the topic of my paper is:Why are crime rates still increasing in the US?

  What elements are necessary for a valid contract to exist

What elements are necessary for a valid contract to exist? Define what constitutes a "valid offer." Evaluate each proposal and discuss whether each of the offers constitutes a valid offer. Why or why not?Each proposal involves a different countr..

  Discuss about the mental health and aging

Select any relevant current event from the news, citing the description of the event from an internet news source.

  What role do you envision yourself having in public health

What role do you envision yourself having in public health? What are three steps you will take to build your public health career? No research citations.

  Which model of modern human evolution did you find

Which model of modern human evolution did you find more convincing, the Replacement Model (Out-of-Africa), or the Multiregional Continuity Model?

  What is the further impact on factor prices and production

What is the further impact on factor prices, production, consumption, and trade if returns to capital in the clothing sector adjust to a given world rate of return via changes in the quantity of capital (FDI) foreigners wish to place in the protec..

  Prepare the assignment on nursing

Discusses the importance of providing age appropriate palliative care reflecting a palliative approach for a person and their family

  Define the chief complaint of diarrhea

A 40 year-old female presents to the office with the chief complaint of diarrhea. She has been having recurrent episodes of abdominal pain

  How the course concepts have influenced your ideas

Determine how the course concepts have influenced your ideas and philosophy of teaching. Recommend changes to the practice of mathematics instruction based on your learning experiences in MTH/156 and MTH/157.

  What is moffit dual taxonomic theory

Discuss the labeling theory. What is Moffit's Dual Taxonomic Theory and do you agree or disagree? If so, explain.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd