python quiz 1

 Start date- 14-04-2021                                                  End date- 27-04-2021



LET'S BEGIN....

________________________________________________________________________________________________________


Q.1. What is the first step in write a program?

1.      Run Code

2.      Write Code

3.      Edit Code

4.      Check the Code

ANSWER :- (2) write code

REASON :- first step whenever we deal with any problem, we have to understand the given problem and write the code accordingly and then check it and solve errors if found, also can edit code wherever required. And then run the code.

________________________________________________________________________________________________________


Q.2. Logical solution is a ____and clear _____procedure to solve the problem, known as _____.

1.       problem description , step-by-step , flowchart

2.       expression , assignment statement , identifier

3.       finite , step-by-step , Algorithm

4.       finite , assignment statement , algorithm

Answer:- (3) finite , step-by-step , Algorithm

Reason:- logical solution is a finite and clear step by step procedure to solve the problem is known as algorithm.

Algorithm is a finite sequence of well defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation.

________________________________________________________________________________________________________

Q.3. Python is a/an___________ language (unlike C, C++, Java).

1.        Logical programming

2.        Interpreted programming

3.        Compiled programming

4.        Complex programming

Answer:- (2)Interpreted programming

Reason:- python is a interpreted programming language. It is  comparable easy to use and implement amongs other programming languages like java , c , c++.

________________________________________________________________________________________________________


Q.4. What is the extension of a python file?

1.        .pi

2.        .pyt

3.        .py

4.        .ptn

Answer:- (3) .py

Reason:-  (.py) extension is used whenever we save any python program. If .py is not used program will unable to run in python ide.

________________________________________________________________________________________________________

Q.5. In Python variables can be thought of as ______.

1.        labels

2.        containers

3.        boxes

4.        tumblers

Answer:- (1) labels

Reason:- In python variables can be thought of as labels. In python everything is an object and variables are just names given to identify these objects.

________________________________________________________________________________________________________


Q.6. Which function is used to get a string in Title Cases (First letter of each word in capital) ?

1.        pint()

2.        title()

3.        strip()

4.        lstrip()

Answer:- (2) title()

Reason:- title() function is used to get a string in title cases. The title() method returns a string where the first character in every word is upper case. Like a header, or a title.

________________________________________________________________________________________________________


Q.7. Which function is used to get rid of the blank spaces on the left?

1.        strip()

2.        left()

3.        rstrip()

4.        lstrip()

Answer:- (4) lstrip()

Reason:- lstrip() is used to get rid of the blank spaces on the left. Here strip() returns a copy of the string with both leading and trailing characters removed , while rstrip() returns a right trim version of the string.

________________________________________________________________________________________________________


Q.8. A Python Program is a sequence of ___ and ___.

1.        data and information

2.        classes and objects

3.        strings and arrays

4.        definitions and commands

Answer:-(4)definitions and commands

Reason:- a python program is a sequence of definitions and commands . 

________________________________________________________________________________________________________


Q.9. What will be the output of : type(3.5) ?

1.        class double

2.        class str

3.        class int

4.        class 'float'

Answer:- (4) class 'float'

Reason:- 3.5 is a number in points means it having a floating function thus it returns a output of type class float.

________________________________________________________________________________________________________


Q.10. What will be the output of : int(2.5) ?

1.   1

2.   3

3.   2

4.   2.5

Answer:- (4) --- 2

Reason:- here declaration and initialization is done in integer format thus it does not store values after decimal thus it's output is 2.

________________________________________________________________________________________________________


Q.11. Any input that you take in Python is of ___ data type.

1.        str

2.        int

3.        float

4.        char

Answer:- (1) str

Reason:- Any input in python is mostly of str data type. Python will judge as to what data type will it fit the best. In case you have entered a number, it will take it as an integer. But if it is raw_input it would certainly be string.

________________________________________________________________________________________________________


Q.12. What is the output of the following : 4//5 ?

1.          1

2.          0.8

3.          0

4.          8

Answer:- (3)     0

Reason:- here the output is zero.

________________________________________________________________________________________________________


Q.13. What will be the value stored in y? : x, y, z = 1, 2, 3

1.         1

2.         2

3.         3

4.         None of these

Answer:- (2).     2

Reason:- here value stored in x=1  ,  y=2    , z=3   thus the output of y be 2.

________________________________________________________________________________________________________


Q.14. Which of the following is a valid identifier or variable?

1.        well&1

2.        well 1

3.        well_1

4.        @well

Answer:- (3).well_1

Reason:- here well_1 is a valid identifier as it does not have any special symbols as others have.

_______________________________________________________________________________________________________

👀👀👀 NEXT QUIZ COMMING SOON STAY UPDATED.......👀👀👀

________________________________________________________________________________________________________






Comments

Post a Comment