/**/ Python & MySQL: April 2020

Sunday, April 26, 2020

PYTHON FUNCTIONS-1

FUNCTIONS -1



1. Which of the following functions is a built-in function in python?

a) max()           b) sqrt()            c) sum()      d) print()
Answer: d

Explanation:  The function seed is a function which is present in the random module. The functions sqrt and factorial are a part of the math module. The print function is a built-in function which prints a value directly to the system output.


2. What is the output of the expression:
round(7.587)

a) 4.5                b) 8                  c) 4      d) 4.6
Answer: b

Explanation:  This is a built-in function which rounds a number to give precision in decimal digits. In the above case, since the number of decimal places has not been specified, the decimal number is rounded off to a whole number. Hence the output will be 8.

3. The function pow(a,b,c) is evaluated as:

a) (a**b)**c                   b) (a**b) / c
c) (a**b) % c                 d) (a**b)*c
Answer: c

Explanation:  The built-in function pow() can accept two or three arguments. When it takes in two arguments, they are evaluated as: a**b. When it takes in three arguments, they are evaluated as: (a**b)%c.


4. What is the output of the function shown below?
all([2,4,0,6])

a) Error             b) True             c) False             d) 0
Answer: c

Explanation:  The function all returns false if any one of the elements of the iterable is zero and true if all the elements of the iterable are non zero. Hence the output of this function will be false.

5. What is the output of the expression?
round(5.5676,2)?

a) 4.5                b) 4.6               c) 5.57        d) 4.56
Answer: c

Explanation:  The function round is used to round off the given decimal number to the specified decimal places. In this case the number should be rounded off to two decimal places. Hence the output will be 5.57.


6. What is the output of the following function?
any([2>8, 4>2, 1>2])

a) Error             b) True             c) False             d) 4>2
Answer: b


Explanation:  The built-in function any() returns true if any or more of the elements of the iterable is true (non zero), If all the elements are zero, it returns false.

7. What is the output of the function shown below?
import math
abs(math.sqrt(49))

a) Error             b) 9                 c) -6                  d) 7.0
Answer: d

Explanation:  The abs() function prints the absolute value of the argument passed. For example: abs(-7)=7. Hence , in this case we get abs(7.0)=7.0.

8. What are the outcomes of the functions shown below?
sum(3,5,7)
sum([2,3,4])

a) Error, 9         b) 15, Error       c) 15, 9     d) Error, Error
Answer: a

Explanation:  The first function will result in an error because the function sum() is used to find the sum of iterable numbers. Hence the outcomes will be Error and 9 respectively.


9. What is the output of the function:
all(3,0,4.2)

a) True             b) False            c) Error             d) 0
Answer: c

Explanation:  The function all() returns ‘True’ if any one or more of the elements of the iterable are non zero. In the above case, the values are not iterable, hence an error is thrown.

10. What is the output of the functions shown below?
min(max(False,-3,-4), 2,7)

a) 2      b) False            c) -3                 d) -4
Answer: b

Explanation:  The function max() is being used to find the maximum value from among -3, -4 and false. Since false amounts to the value zero, hence we are left with min(0, 2, 7) Hence the output is 0 (false).













Sunday, April 19, 2020

To Make Your PC Working Fast With Few Tips



If your PC is running slow then you can use these tips to make your PC working fast. 

Here I am giving you two methods which you can use to make your PC working fast.


FIRST METHOD
  • Click Start buttonègo to runè type %temp% (One folder opened on your screen select all and delete all files)
  • Click Start button è go to runètype temp (One folder opened on your screen select all and delete all files)
  • Click Start button è go to runètype prefetch (One folder opened on your screen select all and delete all files)

Your PC speed will be increased.

SECOND METHOD
  • Go to the Control Panelè SystemèAdvance system settings
  • You look – performanceèClickèsetting
  • One dialog box opened
  • Choose – adjust for best appearance
  • Then click the Apply and OK button

Your PC speed will be increased.

Note: If you want to know anything in computer subject then you can ask in the comment box.

Wednesday, April 15, 2020

Question Bank-1

Dear Students,
I am providing a Question Bank for Class XII. This Question Bank is specially made for IP Students. In this Question Bank I am giving you 15 Questions. Time to time I will provide you Question Bank, that is related to your subject.

Note: If you have any question related to IP Subject you can write in comment box. 


INFORMATICS PRACTICES(065)
XII
Question Bank(Set -1)
Q.1
What is the difference between reindex() and rename()?
Ans
The reindex() function is used to change the order or existing labels in dataframe whereas rename() function renames the existing indexes in dataframe.
Q.2
What is DataFrame?
Ans
It is a 2-dimensional data structure with columns of different types. It is just similar to a spreadsheet or SQL table, or a dict of Series objects. It is generally the most commonly used pandas object.
Q.3
Explain pivot() and pivot_table().
Ans
Pivot –Pivot reshapes data and uses unique values from index/ columns to form axes of the resulting dataframe. Index is column name to use to make new frame’s index.Columns is column name to use to make new frame’s columns.Values  is column name to use for populating new frame’s values.

Pivot_table - Pivot table is used to summarize and aggregate data inside dataframe.
Q.4
Write the similarity and one difference between pivot() and pivot_table()?
Ans
Similarity: Both perform data pivoting a data set
Difference: pivot_table() can work on duplicate entries, whereas pivot() can not deal with duplicate values for one index/column.
Q.5
What are the difference between matplotlib and pyplot?
Ans
The pyplot is one of the interface of matplotlib of python library.The pyplot essentially reproduces plotting functions and behaviours of MATLIB.
Q.6
What is the use of pipe() in python pandas?
Ans
The Pipe() creates a pipe and returns a pair of file descriptors(r,w)usable for reading and writing ,respectively
Q.7
Explain the use of groups in python pandas.
Ans
Pandas dataframe groupby() function is used to split the data into groups based on some criteria. pandas objects can be split on any of their axes. The abstract definition of grouping is to provide a mapping of labels to group  names.
Q.8
Write down name of fuctions to create line chart and bar chart.
Ans
Plot(),Scatter(),bar(),barh()etc.
Q.9
Mention at least four functions for aggregation in Python.
Ans
Max(),min(),count()sum(),mean(),median(),std(),var
Q.10
Differentiate with example between hstack() and vstack().
Ans
hstack() joins arrays horizontally whereas vstack() joins  them vertically.   

Ex.x1=[1,2,3,4]  x2=[10,20,3,40]  x3=[[1,2,3,4],[10,20,30,40]] x4=[100,200] Numpy.hstack(x3,x4) 
Numpy.vstack(x1,x2)

Q.11
What is the basic difference between apply() and applymap() functions in Python?
Ans
Apply() is a series function, that returned single value per column whereas applymap() is an Element function,hence return single value per element.
Q.12
What are the various ways to perform arithmetic operations on numpy arrays?
Ans
+,-,*,%,//,/ and add(),multiply(),subtract(),divide(),mod(),remainder()

Sunday, April 12, 2020

CREATE FORM IN HTML

HTML
In this content you will get the coding of html form. In this content you will get INPUT ELEMENTS, ADDING TEXT BOX, RADIO BUTTON, DROP DOWN LIST, ADDING BUTTONS, etc.
You can easily modify this code.

Note: If you want any HTML code then you can ask in the comment box.

Coding

<html>
<head>
<title>Page Title</title>
</head>

<body bgcolor = "Lightgreen">


<h1 ALIGN=CENTER><u>ADMISSION FORM</u></h1>

<h1>Fill your eglibility and Submit!</h1><BR>

<form>
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname">
  <label for="mname">Middle name:</label>
  <input type="text" id="mname" name="mname">

  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>

  <label for="fname">Father's Name:</label>
  <input type="text" id="fname" name="fname">

 <label for="moname">Mother's Name:</label>
  <input type="text" id="moname" name="moname"><br><br>

  <label for="fmob">Father's Mobile No.:</label>
  <input type="text" id="fmob" name="fmob">

 <label for="mmob">Mother's Mobile No.:</label>
  <input type="text" id="mmob" name="mmob"><br><br>



<br> Select Father's Qualification<br>
<input type = "checkbox" name = "c1" value = "High School" checked> Highschool
<input type = "checkbox" name = "c2" value = "Intermediate" > Intermediate
<input type = "checkbox" name = "c3" value = "Graduation" > Graduation
<input type = "checkbox" name = "c4" value = "Post Graduation" > Post Graduation
<br>
<br> Select Mother's Qualification<br>
<input type = "checkbox" name = "c1" value = "High School" checked> Highschool
<input type = "checkbox" name = "c2" value = "Intermediate" > Intermediate
<input type = "checkbox" name = "c3" value = "Graduation" > Graduation
<input type = "checkbox" name = "c4" value = "Post Graduation" > Post Graduation


<br>
  <input type="radio" id="male" name="gender" value="male">
  <label for="male">Male</label><br>
  <input type="radio" id="female" name="gender" value="female">
  <label for="female">Female</label><br>
  <input type="radio" id="other" name="gender" value="other">
  <label for="other">Other</label><br><br>

<label for="birthday">Date of Birth</label>
<input type="date" id="birthday" name="birthday">

<label for="city">Select Your City</label>
<Select Name= "cities">
<option selected>None</option>
<option>Ambedkar Nagar</option>
<option>Lucknow</option>
<option>Chennai</option>
<option>Mumbai</option>
<option>Delhi<option/></select><br> <br>

<h3>Remarks:<h3>
<textarea rows =6 cols = 80 name = "Remarks">
<Enter your remarks here</textarea>
<br><br>


<button type="Button" style="background-color: red; height: 40px; width: 100px">Submit Form</button>


<button type="Button" style="background-color: lightblue; height: 40px; width: 100px">Reset Form</button>



</form>

</body>

</html>



Thursday, April 9, 2020

FIRST QUESTIONS SET FOR CLASS 12



SHORT TYPE QUESTIONS

Q.1 What is an array?

Q.2 Define the following terms:

  • ndarray
  • array slice
  • array subset


Q.3 What functions can you use for joining two or more ndarrays?

Q.4 What are covariance, correlation and liner regression?

Q.5 Name the function using which you can perform arithmetic operations on ndarrays.

Q.6 Find the output of the following code:

(i) a = np.array([9,5,7,2])
     b = np.array([5,6,7,3])
     c = np.concatenate([a, b])
     print (c)

(ii) name = np.array([[6,7,8,9], [4,3,2,1]])
      x = np.concatenate([name, name])
      print(x)

(iii) a = np.array([5,4,3,2])
       b = np.array([[7,6,4,3], [9,8,1,2]])

      x = np.vstack([a, b])
      print(x)

CLASS XI HALF YEARLY QP WTH MS 2024

  Half Yearly Examination: 2024-25 Informatics Practices (065) Class- XI       Time Allowed: 3hrs                                     ...