Dassault Systemes Python Interview Questions

Dassault Systemes Latest Python Interview Questions Answers

What is the output of print str[2:5] if str = ‘Hello World!’?

It will print characters starting from 3rd to 5th. Output would be llo.

What is the output of print str[2:] if str = ‘Hello World!’?

It will print characters starting from 3rd character. Output would be llo World!.

What is the output of print str * 2 if str = ‘Hello World!’?

It will print string two times. Output would be Hello World!Hello World!.

What Programming Paradigm does Python supports?

Python supports both Procedural Programming approach as well as Object Oriented Programming Approach. Moreover, you can use both the approaches in a single Python program.

How to take input from the User in Python?

Python provides a built-in method to accept input from the user.
It is as follows: input(“Enter the Input”)
However, in order to store the input in a variable, you must write a variable name before the input() method.
It can done as follows: var1=input(“Enter the input”)

How to terminate a line of code in Python?

Python is an extremely efficient and easy to use language. You can terminate a Python line of code using a Semi-Colon. However, it is not mandatory to use a Semi-colon at the end of every line. It is up to you if you want to use it or not.

Enlist Popular Frameworks of Python?

Major Frameworks: Django and Pyramid

Minor Frameworks: Bottle and Flask
Dassault Systemes Most Frequently Asked Latest Python Interview Questions Answers
Dassault Systemes Most Frequently Asked Latest Python Interview Questions Answers

What is Lambda in Python specification?

It is a single expression which is an Anonymous Method often used as Inline function.

Enlist the Applications of Python Programming?

1. Web Application Development and Web Frameworks such as DJango and Pyramid.
2. Game Development
3. Desktop Based Applications
4. Micro Frameworks such as Bottle and Flask

What is the grid() method used for in Python?

grid() method is the one that all the widgets in a Python GUI Program’s frame have. It’s associated with a layout manager, which lets you arrange widgets in a Frame.

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.


How do you define the dimensions of a window in a Python Graphics Program?

We can define the dimensions i.e., width and height of a Window in a Python GUI programming. It can be defined using the geometry() method. It takes in two parameters: width and height respectively.

Example: geometry(“width * height”)

Enlist the Looping constructs available in Python.

Python provides using two looping constructs and these are For Loop and While Loop. Both of these looping constructs are same. The only difference is of the syntax that both of these use.

What is range() method in Python?

Range() method is Python is used as a Looping construct. It takes in 2 mandatory parameters and 1 optional parameter.

Example: range(1,10,2)

This method prints numbers after every alternate iterations between 1 and 10. It prints 1 3 5 7 9.


How can you pick a random item from a list or tuple?

choice(seq) − Returns a random item from a list, tuple, or string.

How can you pick a random item from a range?

randrange ([start,] stop [,step]) − returns a randomly selected element from range(start, stop, step).

How can you get a random number in python?

random() − returns a random float r, such that 0 is less than or equal to r and r is less than 1.

How will you set the starting value in generating random numbers?

seed([x]) − Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None.

Are indentations mandatory to use in Python?

Indentations are very much important to use in Python. We normally do not use braces to indicate the scope of a function in a Python program. Indentation lets the Python Interpreter to understand the scope of a function automatically. Not using indentations properly in a Python program generates errors normally.

Which method is used to find out the location of the pointer in a file?

The tell() method is used to return the current location or position of the read/write pointer within the file. This method doesn’t require any parameter to be passed in it.

Syntax:

FileVariableName.tell()

Post a Comment

Previous Post Next Post