Python Interview questions with basic concepts

Basic Python Questions.

1. A python is a high-level programming language which is completely open source.

2. General purpose, interpreted, Interactive, object-oriented language.

3. 1985-1990 the Python was get found but the full version is coming into the market in year 2000.

4. It is the language found by Guido Van Rossum. 

Python Interview questions with basic concepts

Why we need to learn Python?

As because it is the language which is used to support the features like General purpose, interpreted, Interactive, object-oriented language. It has the plenty of library which is used to solve many more complex problems into the simplified manner. It covers many intraciliary areas so it is more popular.

Introduction to Python:

1. Variables & constants 

2.Data Types (Integral, Boolean, set, sequence, dictionaries)

3. Control flow mechanism. (Decision making rules, Loop)

4. Date and time mechanism.

5. Function 

6. Modules

7. Files (Exception package) 

1. Variables & constants:

A variable is a quantity which always get change during the execution of the program. A constant is a quantity which always remains unchanged during the execution of the program. Python is used to allow the programming in two ways.

1.     Interactive Mode.

2.     Scripting mode.  

[1.] Interactive Mode: 

It is the mode where the user will interact with the OS. (Kernel).

When we are used to type Python statement then the interpreter will display the result immediately.

It is good for learning and exploring the experiment.

Drawback:

1. You are not allowed to run the application as re running through the mode. Here you need to rewrite the entire code once again.

2. Here we are having the prompt call "chevron (>>>)";

>>> 1+1;

>>>2;

[2.] Scripting mode:

1. Here in the script mode when we type the Python statement then we are using the file concept.

2. Using the file mode we can able to save the program for later use.

3. Here every file should be get saved with ".py" extension. 

Drawback:

It will execute bit slower than console. 

Data Types and Values: 

Values: Values are the facts which get defined through 

1. Number (0-9, fractional)

2. String, (A-Z alphanumeric which is being quoted between " ",' ')

3. Letter (' ', " ",0-9, @, $, &) Data Types: 

The data types in Python are used to get defined as 5 types. 

1. Number (Integer, Floating point, Complex)

2. Boolean (True /False)

3. Sequence (String, List, Tuple)

4. Sets

5. Dictionary 

[3.] Number:

1. A number is used to store a numerical value.

2. It is immutable (Their values /items are never allowed to get change).

  • Integers (int) (0-9)
  • Long (int which support the max length) (5692437L)
  • Float (A number when get written along with a decimal values) (56.123)
  • Complex (Here the number should have real and imaginary part) (a+bi) (Here i is sqrt(-1)).

[4.] Sequence:

1.  A sequence is a series which get occurs as per their fixed intervals.

        1,2,3,4,5,6

        1,3,5,7,9

        "Hello world"

2. A sequence is also an ordered set of items which is get identified through the index values.

3. A sequence is a combination of mutable (list) and immutable (tuple)values. String:

In Python the string is used to get denoted as " " or ' '.

"Amit". It is a valid string.

'Amit'. It is a valid string.

"Amit' invalid string.

(Triple quote) it is being used in Python to denote a paragraph.

Read More : Interesting facts of Amazon

1 Comments

Previous Post Next Post