You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-55Lines changed: 50 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -2738,7 +2738,7 @@ b.sayhello()
2738
2738
```
2739
2739
Hello, I’m B
2740
2740
2741
-
Q.26. What is JSON? Describe in brief how you’d convert JSON data into Python data?
2741
+
#### Q. What is JSON? Describe in brief how you’d convert JSON data into Python data?
2742
2742
2743
2743
Ans. JSON stands for JavaScript Object Notation. It is a highly popular data format, and it stores data into NoSQL databases. JSON is generally built on the following two structures:
2744
2744
@@ -2747,27 +2747,7 @@ Ans. JSON stands for JavaScript Object Notation. It is a highly popular data for
2747
2747
2748
2748
Python supports JSON parsers. In fact, JSON-based data is internally represented as a dictionary in Python. To convert JSON data into Python data, we use the load() function from the JSON module.
2749
2749
2750
-
- How can you implement functional programming and why would you?
2751
-
- Explain ctypes and why you would use them?
2752
-
- What is multiple inheritence and when should you use it?
2753
-
- What is a meta class?
2754
-
- What are properties and what's the point?
2755
-
- What's the difference between 2.7+ and 3?
2756
-
- What is a unicode string?
2757
-
- What does the yield statement do?
2758
-
- What is a generator?
2759
-
- Why would I use one?
2760
-
- What is polymorphism, when would I use it?
2761
-
- How do you go about packaging python code?
2762
-
- Is Python compiled?, If yes how so, if not how so.
2763
-
- What does __some-variable__ mean?
2764
-
- Should I import an entire module?
2765
-
- What does dynamicly/duck typed mean?
2766
-
- When would I not use Python?
2767
-
- What is DRY, how can I apply it through OOP or FP?
2768
-
- When would I use Python?
2769
-
2770
-
1. What are the differences between Python and Java ?
2750
+
#### Q. What are the differences between Python and Java ?
2771
2751
2772
2752
Python Vs Java
2773
2753
Comparison Python Java
@@ -2882,14 +2862,14 @@ Global, Local, Module and Class namespaces.
2882
2862
Triple quotes ‘’”” or ‘“ are string delimiters that can span multiple lines in Python. Triple quotes are usually used when spanning multiple lines, or enclosing a string that has a mix of single and double quotes contained therein.
2883
2863
2884
2864
2885
-
Q34. How to use GUI that comes with Python to test your code?
2865
+
#### Q. How to use GUI that comes with Python to test your code?
2886
2866
2887
2867
That is just an editor and a graphical version of the interactive shell. You write or load code and run it, or type it into the shell.
2888
2868
There is no automated testing.
2889
2869
2890
2870
2891
2871
2892
-
Q36. How does the Python version numbering scheme work?
2872
+
#### Q. How does the Python version numbering scheme work?
2893
2873
2894
2874
Python versions are numbered A.B.C or A.B.
2895
2875
@@ -2918,7 +2898,7 @@ In other words, all versions labeled 2.0aN precede the versions labeled 2.0bN, w
2918
2898
2919
2899
You may also find version numbers with a “+” suffix, e.g. “2.2+”. These are unreleased versions, built directly from the subversion trunk. In practice, after a final minor release is made, the subversion trunk is incremented to the next minor version, which becomes the “a0” version, e.g. “2.4a0”.
2920
2900
2921
-
Q37. Where is math.py (socket.py, regex.py, etc.) source file?
2901
+
#### Q. Where is math.py (socket.py, regex.py, etc.) source file?
2922
2902
2923
2903
If you can’t find a source file for a module, it may be a built-in or dynamically loaded module implemented in C, C++ or other compiled language. In this case you may not have the source file or it may be something like mathmodule.c, somewhere in a C source directory (not on the Python Path). There are (at least) three kinds of modules in Python:
2924
2904
@@ -2927,7 +2907,7 @@ If you can’t find a source file for a module, it may be a built-in or dynamica
2927
2907
- Modules written in C and linked with the interpreter; to get a list of these, type;
2928
2908
Import sys print sys.builtin_module_names;
2929
2909
2930
-
Q38. How do I make a Python script executable on UNIX?
2910
+
#### Q. How do I make a Python script executable on UNIX?
2931
2911
2932
2912
You need to do two things:
2933
2913
The script file’s mode must be executable and the first line must begin with “#!” followed by the path of the Python interpreter.
@@ -2952,7 +2932,7 @@ exec python $0 ${1+”$@”}
2952
2932
The minor disadvantage is that this defines the script’s `__doc__`string. However, you can fix that by adding:
2953
2933
`__doc__ = “””…Whatever…”””`
2954
2934
2955
-
Q39. Why don’t my signal handlers work?
2935
+
#### Q. Why don’t my signal handlers work?
2956
2936
2957
2937
The most common problem is that the signal handler is declared with the wrong argument list. It is called as:
2958
2938
handler (signum, frame)
@@ -2968,7 +2948,7 @@ Recompile Python
2968
2948
Re-link it using g++ (change LINKCC in the python Modules Makefile)
2969
2949
Link your extension module using g++ (e.g., “g++ -shared -o mymodule.so mymodule.o”).
2970
2950
2971
-
Q42. How do I send mail from a Python script?
2951
+
#### Q. How do I send mail from a Python script?
2972
2952
2973
2953
Use the standard library module smtplib. Here’s a very simple interactive mail sender that uses it. This method will work on any host that supports an SMTP listener.
2974
2954
```py
@@ -3004,7 +2984,7 @@ sts = p.close()
3004
2984
if sts !=0:
3005
2985
print (“Sendmail exit status”, sts)
3006
2986
```
3007
-
Q43. How can I mimic CGI form submission (METHOD=POST)? I would like to retrieve web pages that are the result of posting a form. Is there existing code that would let me do this easily?
2987
+
#### Q. How can I mimic CGI form submission (METHOD=POST)? I would like to retrieve web pages that are the result of posting a form. Is there existing code that would let me do this easily?
3008
2988
3009
2989
Yes. Here’s a simple example that uses httplib:
3010
2990
```py
@@ -3037,7 +3017,7 @@ print(x)
3037
3017
query_string
3038
3018
‘name=Guy%20Steele,%20Jr.’
3039
3019
```
3040
-
Q44. Why is that none of my threads are not running? How can I make it work?
3020
+
#### Q. Why is that none of my threads are not running? How can I make it work?
3041
3021
3042
3022
As soon as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work.
3043
3023
A simple fix is to add a sleep to the end of the program that’s long enough for all the threads to finish:
@@ -3048,7 +3028,7 @@ for i in range(n): print name, i
3048
3028
for i inrange(10)
3049
3029
```
3050
3030
3051
-
Q45. Installation of Python 3.6.1
3031
+
#### Q. Installation of Python 3.6.1
3052
3032
3053
3033
Download the required 3.6.1 python, executable installer file from the www.python.org.com website.
3054
3034
>
@@ -3077,7 +3057,7 @@ To set Path:
3077
3057
Now path setting is secured.
3078
3058
3079
3059
3080
-
Q46. What Are The Implementation In Python Program?
3060
+
#### Q. What Are The Implementation In Python Program?
Q47. What are The Data Types Supports in Python Language?
3140
+
#### Q. What are The Data Types Supports in Python Language?
3161
3141
3162
3142
- Numbers- Numbers use to hold numerical values.
3163
3143
@@ -3395,8 +3375,6 @@ Constructor
3395
3375
3396
3376
The concept of binding or grouping related data members along with its related functionalities is known as a Encapsulation.
3397
3377
3398
-
3399
-
3400
3378
#### Q. Executing DML Commands Through Python Programs?
3401
3379
3402
3380
DML (Data Modification Language) Commands are used to modify the data of the database objects
@@ -3456,7 +3434,7 @@ For loop takes the given object, convert that object in the form of iterable obj
3456
3434
While getting the one by value element from the iterable object if stop iteration exception is raised then for loop internally handle that exception
3457
3435
3458
3436
3459
-
Q68. OS Module
3437
+
#### Q. OS Module
3460
3438
3461
3439
OS Module is a predefined module and which provides various functions and methods to perform the operating system related activities, such as creating the files, removing the files, creating the directories removing the directories, executing the operating system related commands, etc.
3462
3440
Example:
@@ -3471,8 +3449,6 @@ print(“3”,os.getcwd())
3471
3449
```
3472
3450
Output:
3473
3451
3474
-
3475
-
3476
3452
#### Q. What Are Applications of Python?
3477
3453
3478
3454
Applications of Python
@@ -3504,20 +3480,20 @@ PyChecker is a static analysis tool that detects the bugs in Python source code
3504
3480
3505
3481
3506
3482
3507
-
- What is pass in Python?
3483
+
#### Q. What is pass in Python?
3508
3484
3509
3485
Pass means, no-operation Python statement, or in other words it is a place holder in compound statement, where there should be a blank left and nothing has to be written there.
3510
3486
3511
-
- In Python what are iterators?
3487
+
#### Q. In Python what are iterators?
3512
3488
3513
3489
In Python, iterators are used to iterate a group of elements, containers like list.
3514
3490
3515
3491
3516
-
- In Python what is slicing?
3492
+
#### Q. In Python what is slicing?
3517
3493
3518
3494
A mechanism to select a range of items from sequence types like list, tuple, strings etc. is known as slicing.
3519
3495
3520
-
- What are generators in Python?
3496
+
#### Q. What are generators in Python?
3521
3497
3522
3498
The way of implementing iterators are known as generators. It is a normal function except that it yields expression in the function.
3523
3499
Python generator produces a sequence of values to iterate on. This way, it is kind of an iterable. We define a function that ‘yields’ values one by one, and then use a for loop to iterate on it.
@@ -3586,44 +3562,44 @@ And now, when we call it again, it raises a StopIteration exception. This is bec
3586
3562
- Iterators are more memory-efficient.
3587
3563
3588
3564
3589
-
- How can you copy an object in Python?
3565
+
#### Q. How can you copy an object in Python?
3590
3566
3591
3567
To copy an object in Python, you can try copy.copy () or copy.deepcopy() for the general case. You cannot copy all objects but most of them.
3592
3568
3593
3569
3594
3570
3595
-
- How you can convert a number to a string?
3571
+
#### Q. How you can convert a number to a string?
3596
3572
3597
3573
In order to convert a number into a string, use the inbuilt function str(). If you want a octal or hexadecimal representation, use the inbuilt function oct() or hex().
3598
3574
3599
-
- What is module and package in Python?
3575
+
#### Q. What is module and package in Python?
3600
3576
3601
3577
In Python, module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes.
3602
3578
3603
3579
The folder of Python program is a package of modules. A package can have modules or subfolders.
3604
3580
3605
-
- Mention what are the rules for local and global variables in Python?
3581
+
#### Q. Mention what are the rules for local and global variables in Python?
3606
3582
3607
3583
Local variables: If a variable is assigned a new value anywhere within the function's body, it's assumed to be local.
3608
3584
3609
3585
Global variables: Those variables that are only referenced inside a function are implicitly global.
3610
3586
3611
-
- How can you share global variables across modules?
3587
+
#### Q. How can you share global variables across modules?
3612
3588
3613
3589
To share global variables across modules within a single program, create a special module. Import the config module in all modules of your application. The module will be available as a global variable across modules.
3614
3590
3615
-
- Explain how can you make a Python Script executable on Unix?
3591
+
#### Q. Explain how can you make a Python Script executable on Unix?
3616
3592
3617
3593
To make a Python Script executable on Unix, you need to do two things,
3618
3594
3619
3595
Script file's mode must be executable and
3620
3596
the first line must begin with # ( #!/usr/local/bin/python)
3621
3597
3622
-
- Explain how to delete a file in Python?
3598
+
#### Q. Explain how to delete a file in Python?
3623
3599
3624
3600
By using a command os.remove (filename) or os.unlink(filename)
3625
3601
3626
-
- Explain how can you generate random numbers in Python?
3602
+
#### Q. Explain how can you generate random numbers in Python?
3627
3603
3628
3604
To generate random numbers in Python, you need to import command as
3629
3605
```py
@@ -3639,22 +3615,22 @@ You can access a module written in Python from C by following method,
3639
3615
3640
3616
Module = =PyImport_ImportModule("<modulename>");
3641
3617
3642
-
- Mention the use of // operator in Python?
3618
+
#### Q. Mention the use of // operator in Python?
3643
3619
3644
3620
It is a Floor Divisionoperator , which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, 10//5 = 2 and 10.0//5.0 = 2.0.
3645
3621
3646
-
- Mention five benefits of using Python?
3622
+
#### Q. Mention five benefits of using Python?
3647
3623
- Python comprises of a huge standard library for most Internet platforms like Email, HTML, etc.
3648
3624
- Python does not require explicit memory management as the interpreter itself allocates the memory to new variables and free them automatically
3649
3625
- Provide easy readability due to use of square brackets
3650
3626
- Easy-to-learn for beginners
3651
3627
- Having the built-in data types saves programming time and effort from declaring variables
3652
3628
3653
-
- Mention the use of the split function in Python?
3629
+
#### Q. Mention the use of the split function in Python?
3654
3630
3655
3631
The use of the split function in Python is that it breaks a string into shorter strings using the defined separator. It gives a list of all words present in the string.
3656
3632
3657
-
- Mention what is the difference between Django, Pyramid, and Flask?
3633
+
#### Q. Mention what is the difference between Django, Pyramid, and Flask?
3658
3634
3659
3635
Flask is a "microframework" primarily build for a small application with simpler requirements. In flask, you have to use external libraries. Flask is ready to use.
3660
3636
@@ -3666,7 +3642,7 @@ Like Pyramid, Django can also used for larger applications. It includes an ORM.
3666
3642
3667
3643
The data in the failed server won't get removed, but there is a provision for auto-failure, which you can configure for multiple nodes. Fail-over can be triggered during any kind of socket or Memcached server level errors and not during normal client errors like adding an existing key, etc.
3668
3644
3669
-
- Explain how you can minimize the Memcached server outages in your Python Development?
3645
+
#### Q. Explain how you can minimize the Memcached server outages in your Python Development?
3670
3646
3671
3647
- When one instance fails, several of them goes down, this will put larger load on the database server when lost data is reloaded as client make a request. To avoid this, if your code has been written to minimize cache stampedes then it will leave a minimal impact
3672
3648
- Another way is to bring up an instance of Memcached on a new machine using the lost machines IP address
@@ -4644,3 +4620,22 @@ Without the rstrip(), we would get blank lines between the output.
4644
4620
#### Q. What are iterators and generators?
4645
4621
#### Q. What is Method Resolution Order ?
4646
4622
#### Q. Differentiate between append() and extend() methods ?
4623
+
#### Q. How can you implement functional programming and why would you?
4624
+
#### Q. Explain ctypes and why you would use them?
4625
+
#### Q. What is multiple inheritence and when should you use it?
4626
+
#### Q. What is a meta class?
4627
+
#### Q. What are properties and what's the point?
4628
+
#### Q. What's the difference between 2.7+ and 3?
4629
+
#### Q. What is a unicode string?
4630
+
#### Q. What does the yield statement do?
4631
+
#### Q. What is a generator?
4632
+
#### Q. Why would I use one?
4633
+
#### Q. What is polymorphism, when would I use it?
4634
+
#### Q. How do you go about packaging python code?
4635
+
#### Q. Is Python compiled?, If yes how so, if not how so.
4636
+
#### Q. What does __some-variable__ mean?
4637
+
#### Q. Should I import an entire module?
4638
+
#### Q. What does dynamicly/duck typed mean?
4639
+
#### Q. When would I not use Python?
4640
+
#### Q. What is DRY, how can I apply it through OOP or FP?
0 commit comments