-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRelatedConcepts.txt
More file actions
48 lines (40 loc) · 3.48 KB
/
RelatedConcepts.txt
File metadata and controls
48 lines (40 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
1. What and how many paradigms are there in python? Give Advantages and disadvantages.
ans : Programming paradigms are different ways or styles in which a given program or programming language can be organized.
Each paradigm consists of certain structures, features, and opinions about how common programming problems should be tackled.
python mainly supports 4 programming paradigms:
imperative programming paradigm:
procedural programming paradigm:
Advantages : General-purpose programming, Code re-usability, Portable source code.
Disadvantages : Data protection, Not suitable for real-world objects, Harder to write,
functional programming paradigm:
Advantages : Simple to understand, Making debugging and testing easier, Enhances the comprehension and readability of the code.
Disadvantages : Low performance, Writing programs is a daunting task, Low readability of the code.
object oriented-programming paradigm:
Advantages : Relation with Real world entities,Code re-usability,Abstraction or data hiding.
Disadvantages : Data protection, Not suitable for all types of problems, Slow Speed
2. What is the difference between a module, library, package and framework?
ans : a module is a piece of code that may be built upon, a package is a collection of modules,
a library is a collection of pre-written code, and a framework is a set of principles for developing applications.
3. What is the difference between mutable and immutable?
ans : Mutable objects are those that allow you to change their value or data in place without affecting the object's identity.
In contrast, immutable objects don't allow this kind of operation.
You'll just have the option of creating new objects of the same type with different values.
4. is python a case-sensitive language?
ans : yes.
5. What are arguments?
ans : The terms parameter and argument can be used for the same thing. Information that are passed into a function.
6. What is the difference between if and elif?
ans : Multiple 'if' statements get checked one after another with no regard to the former's results.
'Elif' acts as 'else if', so is checked only in the 'else' case - that is only then, if the first 'if' is False.
If the first 'if' is True, all 'elif' statements are skipped and not checked anymore.
7. What is None in python?
ans : None is used to define a null value or Null object in Python. It is not the same as an empty string, a False, or a zero.
It is a data type of the class NoneType object.
8. What is the difference between homogenous and non-homogenous data structure in python?
ans : Non-homogeneous (Heterogeneous) data structure :- if two or more types of data elements are stored by data structure,
then it is called non-homogeneous or heterogeneous data structure. Example - lists. Homogenous Data structures:
All the elements in the structure are of the same data type. example:- there are no non-homogenous data structure in python.
9. Which one is faster among list, tuple, set, dictionary in python?
ans : tuple>dictionary>list>set. But in the case of searching for an element in a collection, sets are faster because sets have been implemented using hash tables.
tuples are immutable. Dictionary uses hash tables.
#The end.