Tuesday, November 1, 2022

Class 11 CS Assignment


Q. 1: What is the full form of CPU?

(a)   Central Processing Unit

(b)  Control Processing Unit

(c)   Common Processing Unit

(d)  Common Programming Unit

Q. 2: What is the decimal equivalent of binary number 11001?

(a)   3

(b)  25

(c)   31

(d)  None of these

Q. 3: Which is the correct ascending order of memory unit?

(a)   TB, PB, GB, MB

(b)  PB, MB, GB, TB

(c)   MB, GB, TB, PB

(d)  MB, GB, PB, TB

Q. 4: Which of the following is Utility software?

(a)   Windows

(b)  MS-Office

(c)   Tally

(d)  Quick Heal

Q. 5: First General of computer operate with - 

(a)   Vacuum Tube

(b)  Transistor

(c)   IC

(d)  Microprocessor

Q. 6: What is the full form of ISCII?

(a)   International Script Code for Information Interchange

(b)  Indian Script Code for Information Interchange

(c)   Information Script Code for Information Interchange

(d)  Indian Skill Code for Information Interchange

Q. 7: The octal equivalent of the decimal number 417 ------

(a)   619

(b)  640

(c)   641

(d)  598

Q. 8: Convert the Hexadecimal Number 1E2 to decimal?

(a)   480

(b)  482

(c)   483

(d)  484

Q. 9: What is the output of (-22%5) in Python?

(a)   2

(b)  3

(c)   -2

(d)  -3

Q. 10: What is the output of (5 and 3) in Python?

(a)   5

(b)  3

(c)   True

(d)  False

Q. 11: What is the output of (not 5 and 3 or 7)?

(a)   5

(b)  3

(c)   7

(d)  None of these

Q. 12: What is the output of -4j +3?

(a)   -4j +3

(b)  3+4j

(c)   (3-4j)

(d)  3-4j

Q. 13: Which is an immutable type?

(a)   List

(b)  String

(c)   Tuple

(d)  Dictionary

Q. 14: Which is a valid identifier?

(a)   if

(b)  True

(c)   for

(d)  none

Q. 15: Which is a complex number?

(a)   3 + 4i

(b)  2i + 4

(c)   4 – 3j

(d)  3 + (-1)1/2

Q. 16: What is the full form of IDLE?

(a)   Integrated Development Environment  

(b)  Integrated Development and Learning Environment  

(c)   Integrated Design and Learning Environment  

(d)  Integrated Digital and Learning Environment  


Class 12 IP Mid Term Exam solution Oct 2022

 Q: 1 - C 

 Q: 2 - C

 Q: 3 - C

 Q: 4 - A

 Q: 5 - D

 Q: 6 - B

 Q: 7 - D

 Q: 8 - C

 Q: 9 - B

 Q: 10 - B

 Q: 11 - D

 Q: 12 - B

 Q: 13 - A

 Q: 14 - D

 Q: 15 - C

 Q: 16 - B

 Q: 17 - B

 Q: 18 - B

 Q: 19 - Difference between Series and DataFrame

 Q: 20 - Difference Between Switch and Router

 Q: 21 - Explain the three main parts of an optical fibre cable.

Ans

The three basic elements of a fiber optic cable are the core, the cladding and the coating.

A fibre optic cable contains three basic components: 

The core, which carries the light signals; 

The cladding, which surrounds the core with a lower refractive index and contains the light; and 

The coating, which protects the fragile core and cladding within it..


OR

Write the difference between HTML and XML


HTML

XML

HTML stands for Hypertext Markup Language

XML stands for Extensible Markup Language

Case insensitive

Case sensitive

Predefined Tags

User defined Tags

Used to Create Data

Used to Store and Transport Data

Format Driven

Content Driven



 Q: 22 - What is E-waste? Write any four benifit of e-waste management.

E-waste

E-waste is a popular, informal name for electronic products nearing the end of their “useful life.”  Or discarded electronic appliances like Computers, televisions, Mobiles, VCRs, stereos, copiers, and fax machines are common electronic products. Many of these products can be reused, refurbished, or recycled.

Benefits of Recycling E-Waste

1. It protects the environment

2. It reduces business costs

3. It supports non-renewable recycling

4. It shows your eco-friendly credentials

5. It’s super easy to recycle e-waste

 

 Q: 23 - What is plagiarism. Explain types of plagiarism

The act of copying another person’s ideas, words or work and pretending they are your own is called plagiarism.

Types of plagiarism

Complete plagiarism

This overt type of plagiarism occurs when a writer submits someone else’s work in their own name. Paying somebody to write a paper for you, then handing that paper in with your name on it, is an act of complete plagiarism

Direct plagiarism

Direct plagiarism is similar to complete plagiarism in that it, too, is the overt passing-off of another writer’s words as your own. 

 Self-plagiarism

Self-plagiarism can be an issue if you write professionally. When you’re commissioned to write for a client, the client owns that work. Reusing your own words for subsequent clients is plagiarizing your own work and can damage your professional reputation

Accidental plagiarism

 Accidental plagiarism is perhaps the most common type of plagiarism because it happens when the writer doesn’t realize they are plagiarizing another’s work.

 Q: 24 -  Difference between drop, truncate and delete.

Drop:

1. DDL

2. Can not be rollback

3. Used to delete database, table, index etc completly with structure.

Truncate:

1. DDL

2. Can not be rollback

3. Delete all rows of the table at once.

4. Can not delete structure of the table.

5. Where keyword not used

Delete:

1. DML

2. Can be rollback

3. Used to delete one or more rows from the table one by one.

4. Can be used with or without where clause


 Q: 25 - 

Ans:

Alter - DDL

Update - DML

Delete - DML

Truncate - DDL


 Q: 26 - What is IPR? Explain different types of IPR.


Intellectual property rights (IPR) refers to the legal rights given to the inventor or creator to protect his invention or creation for a certain period of time. Patents, trademarks, copyrights, and trade secrets are IPR

Types of IPR

  1. Patents
  2. trademarks
  3. copyrights
  4. trade secrets

Patents

A patent is a government-granted monopoly to build, sell, and use your invention and prevent others from doing so. If you are issued a patent, it’s usually good for 20 years; however, there are some patents that are only good for 14 years.  After 20 years, your patent expires and anyone can copy, build,and sell your invention. So must be renew.

Trademarks

A trademark can be any word, phrase, symbol, design, or combination of these things that identifies your goods or services

Copyrights

Copyrights protect original works of authorship, such as paintings, photographs, musical compositions, sound recordings, computer programs, books, blog posts, movies, architectural works, and plays.

Trade Secrets

A trade secret is typically something not generally known to the public, where reasonable efforts are made to keep it confidential, and confers some type of economic value to the holder by the information not being known by another party. 

Q: 27 What will be the output of the following code?

from matplotlib import pyplot as plt 

x = [4, 8, 3] y = [1, 6, 9] 

plt.plot(x,y) 

plt.title(“details”) 

plt.xlabel(“x axis”) 

plt.ylabel(“y axis”) 

plt.show() 




Q: 28 -  A company Stock price of five days are a follow: [74.25, 76.06, 69.5, 72.55, 81.5]. Write a program to create a bar chart with the given price.

from matplotlib import pyplot as plt

days = [1,2,3,4,5]

stock = [74.25, 76.06, 69.5, 72.55, 81.5]

plt.bar(days,stock)

plt.title("Daywise Stock Price")

plt.xlabel("Day Number")

plt.ylabel("Stock Price")

plt.show()



Q: 29

import pandas as pd

I=["Table","Chair","Bag","Bottle"]

D=[950,800,550,70]

S=pd.Series(D,I)

print(S)

print(S.index[1])

S=S+50

print(S)

print(S.tail(2))

Output:

Table     950

Chair     800

Bag       550

Bottle     70

dtype: int64

Chair

Table     1000

Chair      850

Bag        600

Bottle     120

dtype: int64

Bag       600

Bottle    120

dtype: int64


(a) S.index[1]

(b) S=S+50

(c) S.tail(2)

Q: 30

(a) Select  name,salary from emp where salary=(select min(salary) from emp);

(b) Select  avg(salary) from emp;

(c) update emp set salary=salary+salary*0.1;

Q: 31

Explain the following terms 

(a) Cyber Bullying 

Cyberbullying is when someone, bullies or harasses others on the internet and other digital spaces, particularly on social media sites.


(b) Phishing 

Phishing is described as a fraudulent activity that is done to steal confidential user information such as credit card numbers, login credentials, and passwords. It is usually done by using email or other forms of electronic communication by pretending to be from a reliable business entity.

(c) Indian IT Act 

The Information Technology Act, 2000 was enacted by the Indian Parliament in 2000. It is the primary law in India for matters related to cybercrime and e-commerce. The act was enacted to give legal sanction to electronic commerce and electronic transactions, to enable e-governance, and also to prevent cybercrime.

(d) Trojan Horse 

A Trojan horse is any malware that misleads users of its true intent. The victim receives an official-looking email with an attachment. The attachment contains malicious code that is executed as soon as the victim clicks on the attachment. The effects of Trojans can be highly dangerous. Like viruses, they can destroy files or information on hard disks. They can also capture and resend confidential data to an external address or open communication ports, allowing an intruder to control the infected computer remotely.

(e) Mesh Topology

Mesh topology is a type of networking in which all the computers are inter-connected to each other. The connected nodes can be computers, switches, hubs, or any other devices. In this topology setup, even if one of the connections goes down, it allows other nodes to be distributed. It is most reliable topology.

The number of wires required to connect n nodes in mesh topology is n*(n-1)/2

Q: 32

(i) Suggest a cable layout of connections between the compounds. 





(ii) Suggest the most suitable place (i.e. compound) to house the server for this NGO. Also, provide a suitable reason for your suggestion. 

Training Compound - because it has maximum number of computers.

(iii) Suggest the placement of the following devices with justification: 

(a) Repeater (b) Hub/Switch 

Repeater: As per the above layout the repeater can be avoided as all distances between the compounds are <=100m

Hub/Switch - Training Compound as it is hosting the server.

(iv) The NGO is planning to connect its international office situated in Mumbai, which out of the following wired communication link, will you suggest for a very high speed connectivity? 

(a) Telephone analog line (b) Optical fibre (c) Ethernet cable. 

Optical fibre.

(v) Expand the following ● LAN ● PAN

LAN - Local Area Network

PAN - Personal Area Network


Q: 33

(a) 2

(b)  Indi

(c) 32

(d) 5

(e) Ram


Q: 34

(i) Display the games taken up by the students, whose name starts with ‘S’. 

Select game1,game2 from sports where name like 'S%';

(ii) Write a query to add a new column named MARKS. 

alter table sports add column marks float(5,2);

(iii) Write a query to assign a value 200 for Marks for all those, who are getting grade ‘B’ or grade ‘A’ in both GAME1 and GAME2. 

update sports set marks=200 where grade in ('A','B') and grade1 in ('A','B');

(iv) Write the command used to arrange the whole table in the alphabetical order of NAME? 

alter table sports add column marks float(4,2);


Q: 35

(a) 

loc is label-based, which means that we have to specify the name of the rows and columns that we need to filter out.

Data.loc[“id”]

 iloc is integer index-based. So here, we have to specify rows and columns by their integer index.

df.iloc[0]

data.iloc[1: 5, 2: 5]

(b)


head(): Function which returns the first n rows of the dataset.

tail(): Function which returns the last n rows of the dataset.

import pandas as pd

D=[10,20,30,40,50,60,70,80,90]

I=['a','b','c','d','e','f','g','h','i']

S=pd.Series(D,I)

print(S)

print(S.head())  #print first 5 elements

print(S.tail())     #print last 5 elements

print(S.head(3))    #print first 3 elements

print(S.tail(3))    #print last elements

print(S.head(-2))   #print first n-2 elements (not print last 2 elements)

print(S.tail(-2))   #print last n-2 elements (not print first 2 elements)

Tuesday, October 18, 2022

Class 12 Computer Science (CS) Mid Term Oct 2022 Paper Solution

 1-TRUE

2-A

3-A

4-C

5-B

6-A

7-B

8-C

9-B

10-B

11-B

12-B

13-C

14-A

15-C

16-C

17-C

18-A

19 - “ABC”, “DBA”, 35000

Q: 20: Write the difference between Switch and Router

Switch:

1. Switch is a networking device.

2. Switch is a data link layer device.

3. Switch works in LAN (Local Area Network)

4. Switch works in same network.

5. Switch is an intra-network device

6. Switch use MAC (Media Access Control) address

7. Switch is an intelligent device

8. Data use as a frame format in switch.

9. Switch  use CAM (Content Accessable Memory) table

10. Switch usally used in 8/16/24/48 ports

11. Switch is a multiport device.

12. Switch is a full duplex device

13. No collision occurs in switch.

14. In switch every port has its collision table.

15. Switch support advanced features like VLAN, STP, RSTP etc.

16. Switch is faster than router.

17. Switch support 10 Mbps to 1 Gbps speed.



 Router:

1. Router is a networking device.

2. Router is a Network Layer device.

3. Router works for WAN (Wide Area Network)

4. Router works for communication between different network.

5. Router is an inter network device.

6. Router use IP address

7. Data use as a packet in Router.

8. Router perform routing operation

9. Router use routing table.

10. Router usally support 2/4/8 etc ports

11. Router is slower than switch.

12. Router support 10 Mbps to 100 Mbps speed

Q: 21: Explain the three main parts of an optical fibre cable.

Ans

The three basic elements of a fiber optic cable are the core, the cladding and the coating.

A fibre optic cable contains three basic components: 

The core, which carries the light signals; 

The cladding, which surrounds the core with a lower refractive index and contains the light; and 

The coating, which protects the fragile core and cladding within it..

OR

Write the difference between HTML and XML

ANS:

 

HTML

XML

HTML stands for Hypertext Markup Language

XML stands for Extensible Markup Language

Case insensitive

Case sensitive

Predefined Tags

User defined Tags

Used to Create Data

Used to Store and Transport Data

Format Driven

Content Driven


Q: 22: What will be the output of the following Python code snippet? 

x = 'abcd' 

for i in range(len(x)): 

    x = 'a' 

    print(x)


 ANS:

a

a

a

a


Q: 23: What is function? Explain the different types of functions

A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.

There are two types of functions: 

Built-in functions – 

These functions are pre-defined functions in Python. For Example: print(), input(), int(), float() etc.

User-defined functions – 

These functions are defined by the user to perform a specific task. 

Creating a Function

In Python a function is defined using the def keyword:

def my_function():
  print("Hello from a function")

Calling a Function

To call a function, use the function name followed by parenthesis:

my_function()

Q: 24: Write the difference between drop, truncate and delete.

Drop:

1. DDL

2. Can not be rollback

3. Used to delete database, table, index etc completly with structure.

Truncate:

1. DDL

2. Can not be rollback

3. Delete all rows of the table at once.

4. Can not delete structure of the table.

5. Where keyword not used

Delete:

1. DML

2. Can be rollback

3. Used to delete one or more rows from the table one by one.

4. Can be used with or without where clause

Q: 25: Select type of SQL Query (DDL, DML, DQL, TCL, DCL) 

(a) Alter (b) Update (c) Delete (d) Truncate

Ans:

Alter - DDL

Update - DML

Delete - DML

Truncate - DDL

Q: 26: What is Argument? Explain different types of arguments with example.

  • Parameter: It is the variable listed inside the parentheses in the function definition.
  • Argument: It is a value sent to the function when it is called. It is data on which function performs some action and returns the result.
Types of function arguments
  1. Default argument
  2. Keyword arguments (named arguments)
  3. Positional arguments
  4. Arbitrary arguments (variable-length arguments *args and **kwargs)

Types of Arbitrary Arguments:

  • arbitrary positional arguments (*args)
  • arbitrary keyword arguments (**kwargs)
# function with variable-length arguments def percentage(*args): sum = 0 for i in args: # get total sum = sum + i # calculate average avg = sum / len(args) print('Average =', avg) percentage(56, 61, 73)

Q: 27: Write a function in Python to display the elements of list thrice if it is a number and display the element terminated with ‘#’ if it is not a number. 

For Example:

 L = [41,’Shiva’,’Saanvi’, 13, ‘Madhav’] 

The output should be 

414141 

Shiva# 

Saanvi# 

131313 

Madhav#

Ans:

 L = [41,’Shiva’,’Saanvi’, 13, ‘Madhav’] 

for word in L:

    if word.isdigit():

        print(word*3)

    else:

        print(word+'#')

Q: 28: Write a function ETCount() in Python, which should read each character of a text file “TESTFILE.TXT” and then count and display the count of occurrence of alphabets E and T individually (including small cases e and t too). 

def ETCount() :

    file = open ('TESTFILE.TXT', 'r') 

     lines = file.readlines() 

     countE=0 

     countT=0 

     for w in lines : 

         for ch in w:

             if ch in 'Ee': 

                 countE = countE + 1 

             if ch in 'Tt': 

                 countT=countT + 1 

     print ("The number of E or e : ", countE) 

     print ("The number of T or t : ", countT) 

     file.close()  

Q: 29: Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function. The function returns another list named ‘indexList’ that stores the indices of all Non-Zero Elements of L.


def INDEX_LIST(L): 

     indexList=[] 

     for i in range(len(L)): 

         if L[i]!=0: 

             indexList.append(i) 

     return indexList 

Q: 30:

(a) Write the query to display the name, Salary and Dept_name of each employee. 

select e.e_name,e.salary,d.dept_name from emp as e inner join dept as d on e.dept_no=d.dept_no;

(b) Find the average salary of employees. 

select avg(salary) from emp;

(c) Write the query to Increase the salary by 10% of each employee

update emp set salary=salary*0.1;


Q: 31: A linear stack called status contains the following information: 

(i) Phone number of Employee 

(ii) Name of Employee 

Write the following methods to perform given operations on the stack status: 

(i) Push_element ( ) To Push an object containing Phone number of Employee and Name of Employee into the stack.

 (ii) Pop_element ( ) To Pop an object from the stack and to release the memory. 

(iii) Display() To show all the elements of the stack

emp=[] 

def Push_element():

     phone=input(*Enter the phone number: ")

    name=input("Enter the name of emp: ")

    e=(phone,name)

    emp.append(e)


def Pop_element (): 

    if len(emp)==0: 

         print("Stack Empty") 

    else:

        print("Deleted Element: ", emp.pop())

def Display():

L=len(emp)

while(L>0):

    print(emp[L-1])

    L=L-1

Q: 32: Learn Together is an educational NGO. It is setting up its new campus at Jabalpur for its web-based activities

(i) Suggest a cable layout of connections between the compounds. 



(ii) Suggest the most suitable place (i.e. compound) to house the server for this NGO. Also, provide a suitable reason for your suggestion. 

Training Compound - because it has maximum number of computers.

(iii) Suggest the placement of the following devices with justification: 

(a) Repeater (b) Hub/Switch 

Repeater: As per the above layout the repeater can be avoided as all distances between the compounds are <=100m

Hub/Switch - Training Compound as it is hosting the server.

(iv) The NGO is planning to connect its international office situated in Mumbai, which out of the following wired communication link, will you suggest for a very high speed connectivity? 

(a) Telephone analog line (b) Optical fibre (c) Ethernet cable. 

Optical fibre.

(v) Expand the following ● LAN ● PAN

LAN - Local Area Network

PAN - Personal Area Network


Q: 33: What is the advantage of using a csv file for permanent storage? Write a Program in Python that defines and calls the following user defined functions: 

(i) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’. Each record consists of a list with field elements as empid, name and mobile to store employee id, employee name and employee salary respectively. 

(ii) COUNTR() – To count the number of records present in the CSV file named ‘record.csv’.

Advantage of a csv file: 

1. It is human readable – can be opened in Excel and Notepad applications 

2. It is just like text file 

import csv 

def ADD(): 

fout=open("record.csv","a",newline="\n") 

wr=csv.writer(fout) 

empid=int(input("Enter Employee id :: ")) 

 name=input("Enter name :: ") 

mobile=int(input("Enter mobile number :: ")) 

lst=[empid,name,mobile]

wr.writerow(lst) 

fout.close() 

def COUNTR(): 

fin=open("record.csv","r",newline="\n") 

data=csv.reader(fin) 

 d=list(data) 

 print(len(d))

 fin.close() 

 ADD() 

COUNTR() 

Q: 34: Write SQL commands for (i) to (iv) on the basis of the table SPORTS

(i) Display the games taken up by the students, whose name starts with ‘S’. 

Select game1,game2 from sports where name like 'S%';


(ii) Write a query to add a new column named MARKS. 

alter table sports add column marks float(5,2);

(iii) Write a query to assign a value 200 for Marks for all those, who are getting grade ‘B’ or grade ‘A’ in both GAME1 and GAME2. 

update sports set marks=200 where grade in ('A','B') and grade1 in ('A','B');

(iv) Write the command used to arrange the whole table in the alphabetical order of NAME? 

alter table sports add column marks float(4,2);

Q: 35: Write a menu driven program which insert, delete and display the details of a product such as pid, pname and price using Stack.

http://www.tgtpgtcs.com/2021/02/practical-no-18-write-menu-driven.html

 


Monday, October 10, 2022

Class 12 CS Assignment

 1. Given the list L = [1, 3, 6, 82, 5, 7, 11, 92], What will be the output of print(L[-2:-5:-2])

(a) Empty List

(b) [11, 5]

(c) [82, 7]

(d) None of these

2. Find and write the output of the following Python Code.

a=10

def show():

    global a

    a=15

    b=20

    print(a)

show()

(a) Error

(b) 10

(c) 15

(d) None of these