June 10, 2019

Srikaanth

ThoughtWorks Python Interview Questions Answers

ThoughtWorks Most Frequently Asked Python Latest Interview Questions Answers

How will you convert a string to a frozen set in python?

frozenset(s) − Converts s to a frozen set.

How will you convert an integer to a character in python?

chr(x) − Converts an integer to a character.

How will you convert an integer to an unicode character in python?

unichr(x) − Converts an integer to a Unicode character.

How will you convert a single character to its integer value in python?

ord(x) − Converts a single character to its integer value.

How will you convert an integer to hexadecimal string in python?

hex(x) − Converts an integer to a hexadecimal string.

How will you convert an integer to octal string in python?

oct(x) − Converts an integer to an octal string.
ThoughtWorks Most Frequently Asked Python Latest Interview Questions Answers
ThoughtWorks Most Frequently Asked Python Latest Interview Questions Answers

What is the purpose of ** operator?

** Exponent − Performs exponential (power) calculation on operators. a**b = 10 to the power 20 if a = 10 and b = 20.

What is the purpose of // operator?

// Floor Division − The division of operands where the result is the quotient in which the digits after the decimal point are removed.

What is the purpose of is operator?

is − Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. x is y, here is results in 1 if id(x) equals id(y).

What is the purpose of not in operator?

not in − Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y, here not in results in a 1 if x is not a member of sequence y.

What is the purpose break statement in python?

break statement − Terminates the loop statement and transfers execution to the statement immediately following the loop.

What is the purpose continue statement in python?

Continue statement − Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

Is Python a Scripting Language or not?

Python is a General-Purpose Programming Language or rather a Multi-Purpose Programming Language. It is also a Scripting Language as it can be used to combine it into HTML Code used for Web Development.

Explain modes in Python Programming Environment?

Script Mode: This mode is used to compile and save Python programs which is not possible in the Interactive mode.

Interactive Mode: This mode can be thought of as a scratchpad to check out codes in Python Environment.

In order to make it executable, we should prefer Script Mode.

 What is Slicing in Python?

Slicing is a terminology hat is used to generate sliced or modified output from Lists and Tuples.

Enlist commonly used Classes in games Module in livewires Package?

The commonly used Classes in Games Module under Livewires Package are as follows:
Text
Screen
Sprite
Message

What is the difference between Print(“Hello World”) and print(“Hello World”)?

Python Programming Language is Case-Sensitive. So, Print(“Hello World”) would give an error as the syntax is not correct. However, print(“Hello World”) would work perfectly.

How do you create a RadioButton Element in Python?

The RadioButton Class is available in Tkinter Module. We first need to import it and then we can take in a frame label by the following command:

radiobutton1 = Radiobutton(frame1, text= “C Programming”, value=0)
radiobutton1.grid()

radiobutton1 is a variable to hold the Radio Button Element and frame1 is the the name of the Frame variable onto to which we want to adjust our Radio Button. The default value of a Radio Button is 1 which means ‘Selected’. We need to set it to value=0.

Enlist a difference between Tuples and Lists.

Tuples and Lists are used to store a sequence of data within them. A difference between them is that Tuples once defined cannot be altered under any circumstances whereas Lists can be altered.

What is the difference between a Lambda and Def?

A Def is a function that can contain multiple expressions whereas a Lambda can contain only one single expression. A Def method can contain return statements whereas a Lambda cannot contain return statements. A Lambda can be used inside lists and dictionaries.

What is a Line Continuation Character in Python?

A Line continuation character in Python is the one which lets us to continue a single line of code on the next line without changing its meaning. We can do it using a Line continuation character provided by Python which is a Backslash.

https://mytecbooks.blogspot.com/2018/10/thoughtworks-most-frequently-asked_9.html
Subscribe to get more Posts :