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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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