Sunday 22 December 2019

12th Class Computer Science Python Pre-Board Papers & CBSE Board Papers and Result analysis


 * CBSE Board sample paper 2019-20 with marking scheme (14 pages): Click Here


 * Ist Pre-Board Question Paper(RO Bengaluru)-2019-20 ( 6 pages) : Click Here

 * Ist Pre-Board Marking Scheme-(RO Bengaluru)- 2019-20 (9 pages): Click Here

 * Ist Pre-Board Result analysis-2019-20 (1 page-30 students) : click Here

* IInd Pre-Board Question Paper with Marking Scheme(RO Bengaluru):Click Here




* Sample Paper-1 (Question Paper): Click Here
* Sample Paper-1 (Marking scheme): Click Here

* Sample Paper-2 (Question Paper):Click Here
* Sample Paper-2 (Marking scheme): Click Here

* Sample Paper-3 (Question Paper with Marking scheme): Click Here







12th class Q.No.-1 Revision of python and Function -12 marks Section-A


Q.No.-1 (12 marks) Ch-1 Revision of the basics of python and Ch-2 Function

Click Here

12th class Q.No.-2 File handling to Data structure -18 marks section-A

Q. No.- 2 (18 marks) ch-3 File handling, ch-4 Python Libraries,
ch-5 Recursion, ch-6 Idea of efficiency,
ch-7 Data visualization using pyplot & ch-8 Data structure


Click Here

12th class Q.No.-3 unit-2 Computer Network (15 marks) section-B

Q.No. 3 (15 marks) unit-2 Ch-9 & Ch-10 Computer Network(C N) section-B

click Here

12th class Q.No.-4 unit-3 Data Management sql and django (15 marks)

Q. No.-4 (15 marks) October unit-3 Data management & SQL (DM-2) section-c ch-11 Django, ch-12 Interface python with an Sql database & ch-13 Sql commands: Aggregate function

click here

12th class Q.No.-5 Unit-4 Society Law and Ethics (10 marks)

Q.No.-5 (10 marks) November-unit-4 society, Law and ethics(SLE-2) Ch-14 society, Law and ethics. section-D

Clik Here

Thursday 5 December 2019

11th Class RDBMS information








1. Concept of  a data:
 --  A Database System is basically a record keeping system.
 –   Collected form of data is known as database.
 – “Database is actually a collection of interrelated data so that it can be used by various applications.

2. Relation:
A table is a combination of rows and columns which is also known as Relation.
Relation :  Basically a relation is a table. Its a collection of data in rows and columns

3.Attributes:
 columns of a table are known as attributes

4. Tuples:
 rows of a table are known as tuples

5. Candidate key
 Its a group of attributes which have the properties to be selected as a primary key i.e. These attributes shows their candidature to be a Primary Key.

6. Primary key
It is a group of one or more attributes which are used to uniquely identify records of a relation and can be used to establish relationship with other relation.  Generally all master tables have primary keys. For ex- RollNo in Student table.

7.  Alternate key

 A candidate key which is not a primary key is known as  alternate key.

8. Degree of the table
   In a relation, number of attributes or columns is known as its Degree.

9. Cardinality of  the table
 In a relation, number of tuples or rows is known as its Cardinality.

10. Foreign key
In a table, a non-key attribute which is derived from primary key of some other table is known as foreign key in present table.


DDL and DML Commands:
DDL
-- Command under this category are used to create or modify scheme of database.  It is used to create data dictionary.
– Data Dictionary is a kind of metadata means Data about Data.

 A standard DDL  should have following functions
 – It should identify the types of data division.
 – It should give a unique name of each data item.
 – It should specify the proper data type.
 – It may define the length of data items.
 – It may define the range of values of Data items.

Following commands are under this category-
 – Create, alter and drop schema Objects • Create table,  create database, 
• Alter Table  • Drop Table 

DML
– Data manipulation means- 
 • Accessing the stored data from a Database.
 • Insertion of new information into the Database.
 • Deletion of information from the Database.
 • modification of information in the Database.



Wednesday 4 December 2019

11th class Python SQL Programming

Queries for Aggregate functions- SUM( ), AVG( ), MIN( ), MAX( ), COUNT( )

 Table Name: Student1920




password: root


mysql>show databases;

mysql>create database school;

mysql> use school;

mysql>show tables;

mysql>show databases:



-> Use SQL DDL/DML




a)CREATE TABLE



  create table student1920 

    (

     RollNo int(2) primary key,
     Name char(20),
     Class char(3),
     DOB date,
     Gender char(1),
     City char(10),
     Marks int(3)
     );


mysql>desc student1920;


b)INSERT IN TO


insert into student1920 values(1,"Nanda","X","1995/06/06","M","Agra",551);
insert into student1920 values(2,"Saurabh","XII","1993/05/07","M","Mumbai",462);
insert into student1920 values(3,"Sanal","XI","1994/05/06","F","Delhi",400);
insert into student1920 values(4,"Trisla","XII","1995/08/08","F","Mumbai",450);
insert into student1920 values(5,"Store","XII","1995/10/08","M","Delhi",369);
insert into student1920 values(6,"Marisla","XI","1994/12/12","F","Dubai",250);
insert into student1920 values(7,"Neha","X","1995/12/08","F","Moscow",377);
insert into student1920 values(8,"Nishant","X","1995/06/12","M","Moscow",489);


c)UPDATE TABLE
mysql> UPDATE <TableName>  SET <ColName>=<NewValue>      WHERE  <Condition> 

update student1920 set Class = XII where Name="Nanda";

select  *  from student1920;

d)DELETE FROM
mysql> DELETE FROM <TableName> WHERE <Condition>
DELETE  FROM STUDENT1920 WHERE ROLLNO=4;

select  *  from student1920;

create table stu as(select Name, Marks from student1920 );


DELETE FROM TABLE_NAME;
DELETE FROM STU;

select  *  from student1920;


e) ALTER TABLE

ALTER TABLE table_name ADD column_name datatype;
ex: ALTER TABLE STUDENT1920 ADD MOB CHAR(10);

select  *  from student1920;

f) MODIFY TABLE
ALTER TABLE table_name MODIFY COLUMN column_name datatype;
EX: ALTER TABLE STUDENT1920 MODIFY COLUMN MOB CHAR(11);

select  *  from student1920;

g) DROP TABLE
Syntax for creation of a table from another table is -
 mysql>CREATE TABLE <TableName>    AS (SELECT <Cols> FROM <ExistingTable>   WHERE <Condition>); 

create table stu as(select Name, Marks from student1920 );


Syntax: DROP TABLE TABLE_NAME;
EX: DROP TABLE STU;


h) SELECT-FROM-WHERE-ORDER BY ->BETWEEN, IN, LIKE

Select * from Student1920 Order by name DESC;
Select * from Student1920 Order by name;
Select * from Student1920 Order by name ASC;

select  *  from student1920;

SELECT name, marks, City FROM Student1920 Where Name LIKE "Sa%" ORDER BY Class;
SELECT name, marks, City FROM Student1920 Where Name NOT LIKE "Sa%" ORDER BY Class;

select  *  from student1920;

SELECT name, marks, City FROM Student1920 Where Name LIKE "_____" ORDER BY Class;
SELECT name, marks, City FROM Student1920 Where Name NOT LIKE "_____" ORDER BY Class;

select  *  from student1920;

SELECT name,marks, city FROM student1920 WHERE marks BETWEEN 300 AND 489;

mysql> SELECT name,marks, city FROM student1920 WHERE marks NOT BETWEEN 300 AND 489;
+-------- -+---------+----------+
| name    | marks | city      |
+------- --+----------+---------+
| Nanda  |   551    | Agra    |
| Marisla |   250    | Dubai  |
+---------+-------+-------+-----+

2 rows in set (0.00 sec)



mysql> SELECT * FROM student1920 WHERE city IN('Delhi','Mumbai');
+--------+---------+-------+------------+--------+--------+-------+
| RollNo | Name    | Class | DOB        | Gender | City   | Marks |
+--------+---------+-------+------------+--------+--------+-------+
|      2 | Saurabh | XII   | 1993-05-07 | M      | Mumbai |   462 |
|      3 | Sanal   | XI    | 1994-05-06 | F      | Delhi  |   400 |
|      4 | Trisla  | XII   | 1995-08-08 | F      | Mumbai |   450 |
|      5 | Store   | XII   | 1995-10-08 | M      | Delhi  |   369 |
+--------+---------+-------+------------+--------+--------+-------+
4 rows in set (0.04 sec)

mysql> SELECT * FROM student1920 WHERE city NOT IN('Delhi','Mumbai');
+--------+---------+-------+------------+--------+--------+-------+
| RollNo | Name    | Class | DOB        | Gender | City   | Marks |
+--------+---------+-------+------------+--------+--------+-------+
|      1 | Nanda   | X     | 1995-06-06 | M      | Agra   |   551 |
|      6 | Marisla | XI    | 1994-12-12 | F      | Dubai  |   250 |
|      7 | Neha    | X     | 1995-12-08 | F      | Moscow |   377 |
|      8 | Nishant | X     | 1995-06-12 | M      | Moscow |   489 |
+--------+---------+-------+------------+--------+--------+-------+

4 rows in set (0.00 sec)

-> Aggregate functions: MIN, MAX, AVG, COUNT,SUM

a. Find the minimum marks of a female students in student1920 table.

Solution:- SELECT  min(marks) FROM student1920  WHERE Gender="F";


Select city,Min(marks) from student1920 Group By City;

b. Find the maximum marks of a male students in student1920 table.

Solution:- SELECT name, max(marks) FROM student1920 WHERE Gender="M";


SELECT name, max(marks) FROM student1920 WHERE Gender="F";

mysql> Select Max(marks) from student1920; 
mysql> Select city,Max(marks) from student1920 where City="Delhi";
mysql> Select city,Max(marks) from student1920 Group By City;

c. Find the average marks of the students in student1920 table.

Solution:- SELECT avg(marks) from student1920;


d. Find the number of tuples in the student1920 relation.

Solution:- SELECT count(*) FROM student1920;


e. Find the total marks of those students who work in Delhi city.

Solution:- SELECT sum(marks) FROM student1920 WHERE city="Delhi";






Additional

Syntax for creation of a table from another table is -
 mysql>CREATE TABLE <TableName>    AS (SELECT <Cols> FROM <ExistingTable>   WHERE <Condition>); 

create table stu as(select Name, Marks from student1920 where city='Mumbai');


Wednesday 27 November 2019

Write Python program for sub strings

Method #1 : Using list comprehension + string slicing

# Python3 code to demonstrate working of
# Get all substrings of string
# Using list comprehension + string slicing 
# initializing string
test_str = "Geeks"

# printing original string
print("The original string is : " + str(test_str)) 

# Get all substrings of string
# Using list comprehension + string slicing
res = [test_str[i: j] for i in range(len(test_str))for j in range(i + 1, len(test_str) + 1)]

# printing result
print("All substrings of string are : " + str(res))

Output
== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/x.py ==
The original string is : Geeks
All substrings of string are : ['G', 'Ge', 'Gee', 'Geek', 'Geeks', 'e', 'ee', 'eek', 'eeks', 'e', 'ek', 'eks', 'k', 'ks', 's']





# Python3 code to demonstrate working of
# Get all substrings of string
# Using itertools.combinations()
from itertools import combinations
 
# initializing string 
test_str = "Geeks"
 
# printing original string 
print("The original string is : " + str(test_str))
 
# Get all substrings of string
# Using itertools.combinations()
res = [test_str[x:y] for x, y in combinations(range(len(test_str) + 1), r = 2)]
 
# printing result 
print("All substrings of string are : " + str(res))

Tuesday 26 November 2019

Write a algorithm and python program for string concatenation

# Program-1
>>> 'a' + 'b' + 'c'

Output
'abc'

# program-2
>>> 'do' * 2

Output
'dodo'

# Program-3
>>> orig_string = 'Hello'
>>> orig_string + ', world'
Output
'Hello, world'

>>> orig_string = 'Hello'
>>> orig_string
Output
'Hello'

>>> full_sentence = orig_string + ', world'
>>> full_sentence
'Hello, world'




Sunday 24 November 2019

11th Python program Compare strings

Python string comparison is performed using the characters in both strings. The characters in both strings are compared one by one. When different characters are found then their Unicode value is compared. The character with lower Unicode value is considered to be smaller.


#A  Program

fruit1 = 'Apple'
print(fruit1 == 'Apple')
print(fruit1 != 'Apple')
print(fruit1 < 'Apple')
print(fruit1 > 'Apple')
print(fruit1 <= 'Apple')
print(fruit1 >= 'Apple')

Output
== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/t.py ==
True
False
False
False
True
True



#B Program
print('apple' == 'Apple')
print('apple' > 'Apple')
print('A unicode is', ord('A'), ',a unicode is', ord('a'))


Output
== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/t.py ==
False
True
A unicode is 65 ,a unicode is 97

#Note: ord() function to print the Unicode code point value of the characters.

11th python: Traversing string using for, range function and slice operator

# A
# Python Program for string traversing:
 #Using for loop to traverse over a string in Python

string_to_trav = "Data Science"
for char in string_to_trav:
    print(char)

Output
>>>
== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/t.py ==
D
a
t
a

S
c
i
e
n
c
e

#B
# Using range() to traverse over a string in Python

string_to_trav = "Data Science"
for char_index in range(len(string_to_trav)):
   print(string_to_trav[char_index])

Output
>>>
== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/t.py ==
D
a
t
a

S
c
i
e
n
c
e


#C
# Using slice [] operator to traverse over a string partially

string_to_trav = "Python Data Science"
for char in string_to_trav[0 : 6 : 1]:
   print(char)

== RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/t.py ==
P
y
t
h
o
n

Friday 15 November 2019

Write a Recursive Python program with function BinarySearch(Arr,L,R,X) to search the given element X to be searched from the List Arr having R elements where L represents lower bound and R represents upper bound.

def binarysearch(Arr,L,R,X):
    if R>=L:
        mid=L+(R-L)//2
        if Arr[mid]==X:
            return mid
        elif Arr[mid]>X:
            return binarysearch(Arr,L,mid-1,X)
        else:
            return binarysearch(Arr,mid+1,R,X)
    else:
        return-1


#main program   
Arr=[2,3,4,10,40]
X=int(input("enter element to be searched : "))
result=binarysearch(Arr,0,len(Arr)-1,X)

if result!=-1:
    print("element is present at index ",result)
else:
    print("element is not present in array ")


Output

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
============ RESTART: C:\Users\acer\Desktop\nsp\bimary search.py ============
enter element to be searched : 4
element is present at index  2
>>>
============ RESTART: C:\Users\acer\Desktop\nsp\bimary search.py ============
enter element to be searched : 40
element is present at index  4
>>>
=========== RESTART: C:/Users/acer/Desktop/nsp/bimary search-c.py ===========
enter element to be searched : 3
element is present at index  1
>>> 

Thursday 14 November 2019

Write a Python program with method/function DISPLAYWORDS() to read lines from a text file STORY.TXT, and display those words, which are less than 4 characters.

def displayword():
     file=open("D:\story.txt")
     line=file.read()
     c=0
     word=line.split()
     for w in word:
          if len(w)<4:
               print(w)
     file.close

#main program
displayword()

input
file name: story.txt

then he stooped and 
learned his head against the
wall and without a word he made
a gesture to us with 
his hands.

output
============== RESTART: C:/Users/Student/Desktop/12cs/fi-22.py ==============
he
and
his
the
and
a
he
a
to
us
his
>>> 

Write a Python program with function to count the number of lines in a text file ‘ 'STORY.TXT’ which is starting with an alphabet ‘A’.

def countlines():
     file=open("D:\story.txt.txt")
     lines=file.readlines()
     count=0
     for word in lines:
          if word[0]=="A" or word[0]=="a":
               count=count+1
     print("total lines",count)
     file.close

#main program
countlines()

Input
file name:  story.txt

abcdefoiioioio
h8uhyhy8
Ai9hpu
u8y8887
a9j-j8okjioij


output

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
============== RESTART: C:/Users/Student/Desktop/12cs/fi-21.py ==============
total lines 3
>>> 

Sunday 10 November 2019

Write a algorithm and python function program to search an a element in the tupple(linear search)


# Search function with parameter elements name
# and the value to be searched
def search(Tuple,n):
 
    for i in range(len(Tuple)):
        if Tuple[i] == n:
            return True
    return False


# Main program 
# list which contains both string and numbers in a tupple.
Tuple= (1, 2, 'sachin', 4, 'Geeks', 6)
n = 'sachin'
 
if search(Tuple, n):
    print("Found")
else:
    print("Not Found")

output
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
== RESTART: C:/Users/student/AppData/Local/Programs/Python/Python36-32/q.py ==
sachin
Found
>>>

>>>
== RESTART: C:/Users/student/AppData/Local/Programs/Python/Python36-32/q.py ==
5
Not Found
>>>

Thursday 7 November 2019

11TH CS H.Y EXAMINATION 2019(REGIONAL) QUESTION PAPER


QUESTION PAPER: CLICK HERE

MARKING SCHEME(REFERENCE ONLY): CLICK HERE

12th CS November-2019 Blue print -35 marks


I Django Based application GET and POST request -5 mark

II Interface python  with an SQL database - 5 mark

III SQL Commands: aggregate functions - 5 marks

IV Society, Law and Ethics - 20 marks

Sunday 3 November 2019

Society, Law and Ethics-SLE-2



 The law may be understood as the systematic set of universally accepted rules and regulation created by an appropriate authority such as government, which may be regional, national, international, etc. It is used to govern the action and behavior of the members and can be enforced, by imposing penalties.

Ethics are the principles that guide a person or society, created to decide what is good or bad, right or wrong, in a given situation. It regulates a person’s behavior or conduct and helps an individual in living a good life, by applying the moral rules and guidelines.

intellectual property rights

A right that is had by a person or by a company to have exclusive rights to use its own plans, ideas, or other intangible assets without the worry of competition, at least for a specific period of time. These rights can include copyrights, patents, trademarks, and trade secrets. These rights may be enforced by a court via a lawsuit. The reasoning for intellectual property is to encourage innovation without the fear that a competitor will steal the idea and / or take the credit for it.


Plagiarism as copying another's work or borrowing someone else's original ideas. But terms like "copying" and "borrowing" can disguise the seriousness of the offense:

  • to steal and pass off (the ideas or words of another) as one's own
  • to use (another's production) without crediting the source
  • to commit literary theft
  • to present as new and original an idea or product derived from an existing source
In other words, plagiarism is an act of fraud. It involves both stealing someone else's work and lying about it afterward

Digital rights management
DRM – A scheme that controls access to copyrighted material using technological means. It means applying technology on copyrighted material in such a way that it can be used or it remain in read only mode but further production/copying is restricted.

                                                        Licensing
 A software license is a document that provides legally binding guidelines to the person who holds it for the use and distribution of software. It typically provide end users with the right to make one or more copies of the software without violating copyrights. It also defines the responsibilities of the parties entering into the license agreement and may impose restrictions on how the software can be used. Software licensing terms and conditions usually include fair use of the software, the limitations of liability, warranties and disclaimers and protections.

Licensing (Creative Commons )
Creative Commons (CC) is an internationally active non-profit organization to provide free licenses for creators to use it when making their work available to the public in advance under certain conditions.

Licensing (GPL)
GPL - General Public License( GPL), is the most commonly used free software license, written by Richard Stallman in 1989 of Free Software Foundation for Project. This license allows software to be freely used(means freedom for use,not price wise free), modified, and redistributed by anyone. WordPress is also an example of software released under the GPL license, that’s why it can be used, modified, and extended by anyone.

Licensing (Apache)
The Apache License is a free and open source software (FOSS) licensing agreement from the Apache Software Foundation (ASF). Beginning in 1995, the Apache Group (later the Apache Software Foundation) Their initial license was essentially the same as the old BSD license. Apache did likewise and created the Apache License v1.1 - a slight variation on the modified BSD license. In 2004 Apache decided to depart from the BSD model a little more radically, and produced the Apache License v2.  ( Berkeley Software Distribution (BSD), )

                                               Open Source 
open source means any program whose source code is made available publically for use or modification as users or other developers see fit. Open source software is usually made freely available.

                                               Open data
Open data is data which can be accessed, used and shared by any one to bring about social, economic and environmental benefits. Open data becomes usable when made available in a common , machine-readable format.

                                            Privacy 
Privacy is the aspect of information technology which deals with the ability of an organization or individual to determine what data in a computer system can be shared with third parties.

privacy laws
 privacy law - Regulations that protects a person's/organization’s data private and governs collection, storage, and release of his or her financial, medical, and other personal information to third party. Classification of privacy laws • General privacy laws that have an overall bearing on the personal information of individuals • Specific privacy laws that are designed to regulate specific types of information. E.g Communication privacy laws, Financial privacy laws,Health privacy laws,Information privacy laws ,Online privacy laws ,Privacy in one’s home.

     Fraud
 Computer fraud is using a computer and/or internet to take or alter electronic data, or to gain unlawful use of a computer/internet. Illegal computer activities include phishing, social engineering, viruses.

Cyber crime 
 Any crime that involves a computer and a network is called a “Computer Crime” or “Cyber Crime. Or in other term ,it is a crime in which a computer is the object of the crime (hacking, phishing, spamming) or is used as a tool to commit an offense (child pornography, hate crimes).

Cyber crime (Phishing)
Phishing is a cyber attack that uses disguised email as a weapon.The attackers masquerade as a trusted entity of some kind, The goal is to trick the email recipient into believing that the message is something they want or need — recipient fills/send sensitive information like account no, username ,password etc. ,then attacker use these.

Cyber crime (Illegal downloading)
Illegal downloading is obtaining files or computer resources that w do not have the right to use from the Internet. Copyright laws prohibit Internet users from obtaining copies of media that we do not legally purchase. These laws exist to prevent digital piracy, much of which is generally conducted through Internet file sharing.

Cyber crime(Child pornography) 
Child pornography is considered to be any depiction of a minor or an individual who appears to be a minor who is engaged in sexual or sexually related conduct. This includes pictures, videos, and computer-generated content. Even altering an image or video so that it appears to be a minor can be considered child pornography.

Cyber crime (Scams)
Scams:  With the growth in online services and internet use, there are many opportunities for criminals to commit scams and fraud. These are dishonest schemes that seek to take advantage of unsuspecting people to gain a benefit (such as money, or access to personal details). These are often contained in spam and phishing messages.

Cyber crime (Cyber forensics)
Cyber forensics is a way or an electronic discovery technique which is used to determine and reveal technical criminal evidence. Various capabilities of cyber forensics

IT Act 2000
The Information Technology Act, 2000 provides legal recognition to the transaction done via an electronic exchange of data and other electronic means of communication or electronic commerce transactions.Some of sections under it act 2000 are given below.
SECTI ON , OFFENCE  , PENALTY

67A                 
Publishing images containing sexual acts
Imprisonment up to seven years, or/and with fine up to Rs. 1,000,000

 67B 
Publishing child porn or predating children online
Imprisonment up to five years, or/and with fine up to Rs.1,000,000 on first conviction. Imprisonment up to seven years, or/and with fine up to Rs.1,000,000 on second conviction. 

67C
Failure to maintain records 
Imprisonment up to three years, or/and with fine.

Technology and society:
Technology affects the way individuals communicate,learn,andthink.Technology has both positive and negative affects on society including the possible improvement or declination of society. Society is defined as,"the sum of social relationships among humanbeings "and technology is defined as, "the body of knowledge available to acivilization that is of use in fashioning implements, practicing manual arts and skills, and extracting or collecting materials. "Technology shapes our society and has both positive and negative affects".

Societal issues and cultural changes induced by technology
Cultural changes–
Technology has completely changed our culture. From our
values, To our means of communication. Now, Many people
have trouble having a face to face conversation, Skype does
not count. When people spend time with friends, Its on their
phones, Tablets, Or computers. Also, Now people judge
others by how techy their car is, Or if they have the newest
iPhone or Tablet Most people want to put their headphones in
and listen to music rather than listening to another person.
Video games isolate all things from the world. Most people
prefer technology today, Just because that is all they know.
Today it’s all about touch screen cell phones. Technology just
isolates people from reality. People now a days don’t know
how to communicate in real world situations like personal
relationships, Problem solving and exhibiting adult behaviors.

E-waste Management:
Whenever an electronic device covers up its working life,or becomes non-usable due to technological advancements or becomes non-functional, it is not used any more and comes under the category of e-waste or electronic waste. As the technology is changing day by day, more and more electronic devices are becoming non-functional and turning in to e-waste. Managing such non-functional electronic devices is termed as e-waste management.

E-waste Management:(Proper disposal of used electronic gadgets)
E-waste is a growing problem for us in India. As an 132cr
strong economy, we produce e- waste in large quantities.
It is very important to dispose off waste in a pragmatic
manner.
Ways to dispose off e-waste:
1. Give Back to Your Electronic Companies and Drop Off
Points
2. Visit Civic Institutions
3. Donating Your Outdated Technology
4. Sell Off Your Outdated Technology
5. Give Your Electronic Waste to a Certified E-Waste
Recycler

Identity theft:

Identity theft occurs when some one uses our identity or personal information—such as our name, our license,or our Unique ID number—without our permission to commit a crime or fraud.

Unique IDs and biometrics
A unique identifier (UID) is a numeric or alphanumeric string that is associated with a single entity with in a given system. UIDs make it possible to address that entity, so that it can be accessed and interacted with.

Biometrics is the science of analyzing physical or behavioral characteristics specific to each individual in order to be able to authenticate their identity.

Gender and disability issues while teaching/using computers

Disability Issues
1.Unavailability of teaching materials/aids
2.Lack of special needs teachers
3.Lack of supporting curriculum
Possible Solution
•Enough teaching aids must be prepared for specially abled students
•Must employ special needs teachers
•Curriculum should be designed with students with specially abled students in mind.




Wednesday 30 October 2019

Write a SQL query to order the (student ID, marks) table in descending order of the marks.


create table student
     (student_id int(5) primary key,
     name char(20),
     class char(3),
     DOB date,
     gender char(1),
    city char(10),
    marks int(3)
    );
Query OK, 0 rows affected, 2 warnings (1.42 sec)

desc student;
+------------+----------+------+-----+---------+-------+
| Field      | Type     | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+-------+
| student_id | int(5)   | NO   | PRI | NULL    |       |
| name       | char(20) | YES  |     | NULL    |       |
| class      | char(3)  | YES  |     | NULL    |       |
| DOB        | date     | YES  |     | NULL    |       |
| gender     | char(1)  | YES  |     | NULL    |       |
| city       | char(10) | YES  |     | NULL    |       |
| marks      | int(3)   | YES  |     | NULL    |       |
+------------+----------+------+-----+---------+-------+
7 rows in set (0.02 sec)

insert into student values(12301,"abhinav","X","1995/06/06","M","Agra",551);
insert into student values(12302,"abhineet","XII","1993/05/07","M","Mumbai",462);
insert into student values(12303,"aniket","XI","1994/05/06","F","Delhi",400);
insert into student values(12304,"apar","XII","1995/08/08","F","Mumbai",450);
insert into student values(12305,"brij","XII","1995/10/08","M","Delhi",369);
insert into student values(12306,"bhuvnesh","XI","1994/12/12","F","Dubai",250);
insert into student values(12307,"devesh","X","1995/12/08","F","Moscow",377);
insert into student values(12308,"dhruva","X","1995/06/12","M","Moscow",489);

select * from student;
+-------------+----------+-------+------------+--------+--------+-------+
| student_id | name     | class |   DOB        | gender | city       | marks |
+-------------+----------+-------+------------+--------+--------+-------+
|      12301    | abhinav    | X       | 1995-06-06 | M        | Agra      |   551 |
|      12302    | abhineet   | XII     | 1993-05-07 | M        | Mumbai |   462 |
|      12303    | aniket       | XI      | 1994-05-06 | F         | Delhi      |   400 |
|      12304    | apar          | XII     | 1995-08-08 | F         | Mumbai |   450 |
|      12305    | brij            | XII     | 1995-10-08 | M        | Delhi      |   369 |
|      12306    | bhuvnesh | XI      | 1994-12-12 | F         | Dubai     |   250 |
|      12307    | devesh      | X       | 1995-12-08 | F         | Moscow |   377 |
|      12308    | dhruva      | X       | 1995-06-12 | M        | Moscow  |   489 |
+------------+----------+-------+------------+--------+--------+-------+
8 rows in set (0.00 sec)

 select student_id,marks from student order by marks;
+------------+-------+
| student_id | marks |
+------------+-------+
|      12306 |   250 |
|      12305 |   369 |
|      12307 |   377 |
|      12303 |   400 |
|      12304 |   450 |
|      12302 |   462 |
|      12308 |   489 |
|      12301 |   551 |
+------------+-------+
8 rows in set (0.00 sec)

mysql> select student_id,marks from student order by marks desc;
+------------+-------+
| student_id | marks |
+------------+-------+
|      12301 |   551 |
|      12308 |   489 |
|      12302 |   462 |
|      12304 |   450 |
|      12303 |   400 |
|      12307 |   377 |
|      12305 |   369 |
|      12306 |   250 |
+------------+-------+
8 rows in set (0.00 sec)

Monday 28 October 2019

Find the total number of customers from each country in the table (customer ID, customer name, country) using group by.

create table customer
     (cust_ID integer primary key,
     cust_name char(20),
     country char(10)
     );

mysql> desc customer;
+-----------+----------+------+-----+---------+-------+
| Field     | Type     | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| cust_ID   | int(11)  | NO   | PRI | NULL    |       |
| cust_name | char(20) | YES  |     | NULL    |       |
| country   | char(10) | YES  |     | NULL    |       |
+-----------+----------+------+-----+---------+-------+
3 rows in set (0.00 sec)

insert into customer values(101,"Bhuvanesh","Pakistan");
insert into customer values(102,"Aniket","India");
insert into customer values(103,"Devesh","Srilanka");
insert into customer values(104,"Jashan","Pakistan");
insert into customer values(105,"Jatin","Japan");
insert into customer values(106,"Apar","India");
insert into customer values(107,"Ashish","Nepal");
insert into customer values(108,"Priyanshu","Srilanka");
insert into customer values(109,"Vasu","Bangladesh");
insert into customer values(110,"Omprakash","Japan");
insert into customer values(111,"Prateek","India");

mysql> select * from customer;
+---------+-----------+------------+
| cust_ID | cust_name | country    |
+---------+-----------+------------+
|     101 | Bhuvanesh | Pakistan   |
|     102 | Aniket    | India      |
|     103 | Devesh    | Srilanka   |
|     104 | Jashan    | Pakistan   |
|     105 | Jatin     | Japan      |
|     106 | Apar      | India      |
|     107 | Ashish    | Nepal      |
|     108 | Priyanshu | Srilanka   |
|     109 | Vasu      | Bangladesh |
|     110 | Omprakash | Japan      |
|     111 | Prateek   | India      |
+---------+-----------+------------+
11 rows in set (0.10 sec)

mysql> select distinct(country) from customer;
+------------+
| country    |
+------------+
| Pakistan   |
| India      |
| Srilanka   |
| Japan      |
| Nepal      |
| Bangladesh |
+------------+
6 rows in set (0.03 sec)


mysql> select country, count(country) from customer group by country;
+------------+----------------+
| country    | count(country) |
+------------+----------------+
| Pakistan   |              2 |
| India      |                3 |
| Srilanka   |              2 |
| Japan      |              2 |
| Nepal      |              1 |
| Bangladesh |              1 |
+------------+----------------+
6 rows in set (0.04 sec)






Wednesday 23 October 2019

Find the min, max, sum, and average of the marks in a student marks table.


Queries for Aggregate functions- SUM( ), AVG( ), MIN( ), MAX( ), COUNT( )

 Table Name: Student1920


mysql> use school;
Database changed
mysql> create table student1920
    (RollNo int(2) primary key,
     Name char(20),
     Class char(3),
     DOB date,
     Gender char(1),
     City char(10),
     Marks int(3)
     );
insert into student1920 values(1,"Nanda","X","1995/06/06","M","Agra",551);
insert into student1920 values(2,"Saurabh","XII","1993/05/07","M","Mumbai",462);
insert into student1920 values(3,"Sanal","XI","1994/05/06","F","Delhi",400);
insert into student1920 values(4,"Trisla","XII","1995/08/08","F","Mumbai",450);
insert into student1920 values(5,"Store","XII","1995/10/08","M","Delhi",369);
insert into student1920 values(6,"Marisla","XI","1994/12/12","F","Dubai",250);
insert into student1920 values(7,"Neha","X","1995/12/08","F","Moscow",377);
insert into student1920 values(8,"Nishant","X","1995/06/12","M","Moscow",489);



a. Find the average marks of the students in student1920 table.

Solution:- SELECT avg(marks) from student1920;


b. Find the minimum marks of a female students in student1920 table.

Solution:- SELECT name, min(marks) FROM student1920  WHERE Gender="F";


c. Find the maximum marks of a male students in student1920 table.

Solution:- SELECT name, max(marks) FROM student1920 WHERE Gender="M";


d. Find the total marks of those students who work in Delhi city.

Solution:- SELECT sum(marks) FROM student1920 WHERE city="Delhi";


e. Find the number of tuples in the student1920 relation.

Solution:- SELECT count(*) FROM student1920;

Take a sample of 10 phishing e-mails and find the most common words.

# Write a program to find the most common words in a file.


import collections
fin = open('D:\\email.txt','r')
a= fin.read()
d={ }
L=a.lower().split()

for word in L:
     word = word.replace(".","")
     word = word.replace(",","")
     word = word.replace(":","")
     word = word.replace("\"","")
     word = word.replace("!","")
     word = word.replace("&","")
     word = word.replace("*","")

for k in L:
     key=k
     if key not in d:
           count=L.count(key)
           d[key]=count


n_print = int(input("How many most common words to print: "))
print("\nOK. The {} most common words are as follows\n".format(n_print))

word_counter = collections.Counter(d)
for word, count in word_counter.most_common(n_print):
      print(word, ": ", count)

fin.close()


OUTPUT:

How many most common words to print: 5
OK. The 5 most common words are as follows

the : 505
a : 297
is : 247
in : 231
to : 214


Write a program to write those lines which have the character 'a' from one text file to another text file.

Note:
 - Open widows D drive and open book.txt file and
     type the number of lines

fin=open("D:\\book.txt","r")
fout=open("D:\\story.txt","a")
s=fin.readlines()
for j in s:
   if 'a' in j:
      fout.write(j)
fout.close()
fin.close()


Output:
**Write contents of book.txt and story.txt

-  After executing above program open story.txt file

book.txt file
jkjhkll aa
kllkklk
twinkla jsad

story.txt

jkjhkll aa
twinkla jsad

Compute EMIs for a loan using the numpy librarary


* Open the cmd prompt window 

    pip install numpy



* Open the python window

import numpy as np

interest_rate= float(input("Enter the interest rate : "))

monthly_rate = (interest_rate)/ (12*100)

years= float(input("Enter the total years : "))

number_month = years * 12

loan_amount= float(input("Enter the loan amount : "))

emi = abs(np.pmt(monthly_rate, number_month, loan_amount))

print("Your EMI will be Rs. ", round(emi, 2))



Output

Enter the interest rate : 7.5

Enter the total years : 15

Enter the loan amount : 200000

Your EMI will be Rs. 1854.02