Skip to main content

ads1

Class 11th Chapter -4 Data Handling

 Class 11th Chapter -4 Data Handling 

IMPORTANT TERM 
1.Atom :- Something that has a value
2.Coercion :-implicit Type Conversion
3.Expression :- Valid combination of operators and atoms
4.Explicit Type Conversion :- Forced data type conversion by the User
5.Immutable Type :- A type whose value is not changeable in place.
6.Implicit Type Conversion :- Automatic Internal Conversion of data type lower to higher type by Python.  
7.Mutable Type :- A type whose value a changeable in place
8.Operator :- Symbol/word that triggers on action or operation
9.Type Costing :-Explicit Type Conversion

Answer the following Question.....

1. What are data types ? What are Python's built-in core data types ? 
SOLUTION:- 

The real life data is of many types. So to represent various types of real-life data, programming languages provide ways and facilities to handle these, which are known as data types, Python's built-in core data types belong to 

Numbers (integer, floating-point, complex numbers, Booleans)
String 
Tuple
List
Dictionary 

2.Which data types of Python handle Numbers?
SOLUTION Python provides following data types to handle numbers
(i) Integers
(ii) Boolean
(iii) Floating-point numbers 
(iv) complex numbers

3. Why is Boolean considered a subtype of integers?
SOLUTION Boolean values True and False internally map to integers 1 and 0. That is, internally True is considered equal to 1 and False equal to 0 (zero). When I and 0 are converted to Boolean through bool() function, they return True and False. That is why Booleans are treated as a subtype of integers.

4.What do you understand by term 'immutable?
SOLUTION:- 
Immutable means unchangeable. In Python, immutable types are those whose values cannot be changed in place. Whenever one assigns a new value to a variable referring to immutable type, variable's reference is changed and the previous value is left unchanged. e.g.
x=3 
x=5

5. What do you mean by Syntax errors and Semantics errors? 
SOLUTION :-
Syntax errors are the errors that occur when rules of a programming language violated.
Semantics errors occur when statements are not meaningful.

6.Why are logical errors harder to locate?
SOLUTION :- 
In spite of logical errors presence, the program executes without any problems but the output produced is not correct. Therefore, each and every statement of the program needs to b scanned and interpreted. Thus the logical errors are harder to locate. 

7. What is an Exception?
SOLUTION :- 
Exception in general refers to some contradictory or unusual situation which can be encountered unexpectedly while executing a program.








ads2

Popular posts from this blog

11. Write a Java program to input basic salary of an employee and calculate its Gross salary according to following:

    11. Write a Java program to input basic salary of an employee and calculate its Gross salary according to following: Basic Salary <= 10000 : HRA = 20%, DA = 80% Basic Salary <= 20000 : HRA = 25%, DA = 90% Basic Salary > 20000 : HRA = 30%, DA = 95% Static Solution :-  class salary {     public static void main(String args[])     {     double basic=20000.50,gross,da,hra;     if(basic <=10000)     {         da = basic * 0.8;         hra = basic *0.2;     }              else if(basic <=20000)     {         da = basic * 0.9;         hra = basic *0.25;     }     else     {         da = basic * 0.95;         hra = basic * 0.3;     }     gross = basic + da + hra;     System.out.println("The Gross Salary is :-"+gross);     } } Output :-  Dynamic Solution :-  class salary {     public static void main(String args[])     {     double basic=20000.50,gross,da,hra;     Scanner in = new Scanner(System.in);     System.out.println("Enter the Basic Salary

1. Given the school result data, analyses the performance of the students on #different parameters, e.g subject wise or class wise.

1. Given the school result data, analyses the performance of the students on #different parameters, e.g subject wise  or class wise. Solution :-   # x-axis is shows the subject and y -axis # shows the markers in each subject # import pandas and matplotlib  import pandas as pd  import matplotlib.pyplot as plt # Simple Line Chart with setting of Label of X and Y axis, # title for chart line and color of line  subject = ['Physic','Chemistry','Mathematics', 'Biology','Computer'] marks =[80,75,70,78,82] # To draw line in red colour plt.plot(subject,marks,'r',marker ='*')     # To Write Title of the Line Chart plt.title('Marks Scored') # To Put Label At Y Axis plt.xlabel('SUBJECT')           # To Put Label At X Axis plt.ylabel('MARKS')             plt.show() Output :- 

24.Create a Data Frame quarterly sales where each row contains the item category, item name, and expenditure. Group the rows by the category and print the total expenditure per category.

24.Create a Data Frame quarterly sales where each row contains the item category, item name, and expenditure. Group the rows by the category and print the total expenditure per category. import pandas as pd  # initialize list of lists data = [['CAR','Maruti',1000000],['AC','Hitachi',55000],['AIRCOLLER','Bajaj',12000], ['WASHING MACHINE','LG',15000],['CAR','Ford',7000000],['AC','SAMSUNG',45000],['AIRCOLLER','Symphony',20000],['WASHING MACHINE','Wirlpool',25000]] Col=['itemcat','itemname','expenditure'] # Create the pandas DataFrame qrtsales = pd.DataFrame(data,columns=Col) # print dataframe.  print (qrtsales) qs=qrtsales.groupby('itemcat')  print('Result after Filtering Dataframe')  print(qs['itemcat','expenditure'].sum()) Output :-