Professional Documents
Culture Documents
Create a bankFees() method to apply the bank fees with a percentage of 5% of the balance
account.
class BankAccount:
self.accountNumber = accountNumber
self.name = name
self.balance = balance
def Deposit(self , d ):
self.balance = self.balance + d
else:
self.balance = self.balance - w
def bankFees(self):
self.balance = (95/100)*self.balance
def display(self):
newAccount.Withdrawal(300)
newAccount.Deposit(200)
newAccount.display()
Create a display() method that displays the name and age of an object created via the Person
class.
Create a child class Student which inherits from the Person class and which also has a section
attribute.
Create a method displayStudent() that displays the name, age and section of an object created
via the Student class.
Create a student object via an instantiation on the Student class and then test the
displayStudent method.
class Person:
self.name = name
self.age = age
def display(self):
class Student(Person):
Person.__init__(self,name, age)
self.section = section
def displayStudent(self):
P.display()
print("-------------------------------")
S = Student("Albert", 23 , "Mathematics")
S.displayStudent()
- News (aside/article/section)
- Announcements (aside/article/section)
Use these tags: <header>, <nav>, <aside>, <article>, <section>, <time>, <footer>.
Here logo image, news, announcements used can be any suitable data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> GU WEBSITE</title>
</head>
<body>
<div class="image">
<div class="navbar">
<p>GALGOTIAS UNIVERSITY</p>
<ul>
<li><a href="https://www.slideshare.net/deepakchand19762001/galgotias-university-
presentation"> PRESENTATION</a> </li>
<div class="dropdown">
<button class="dropbtn">STUDIES
</button>
<div class="dropdown-content">
<a href="https://www.shiksha.com/university/galgotias-university-greater-noida-
37105/courses/humanities-and-social-sciences-s">SOCIAL SCIENCES</a>
<a href="https://www.shiksha.com/university/galgotias-university-greater-noida-
37105/course-b-tech-in-civil-engineering-237402">ENGINEERING</a>
</div>
</div>
</ul>
</div>
<div class="main">
<marquee class="marq"
background-color="Green"
direction="up"
loop="">
<a href="https://timesofindia.indiatimes.com/home/education/news/galgotias-university-
to-open-deendayal-upadhyaya-higher-quality-center-for-students-from-weaker-sections/
articleshow/81094067.cms">Galgotias University to open 'Deendayal Upadhyaya Higher Qua ..
<marquee class="marq"
background-color="Green"
direction="up"
loop="">
</div>
</div>
<footer>
<p>Galgotias University</p>
<p><a href="mailto:admissions@galgotiasuniversity.edu.in
">admissions@galgotiasuniversity.edu.in </a></p>
</footer>
</body>
</html>
CSS CODE:
*{
margin:0;
padding:0;
font-family:sans-serif;
.image {
width:100%;
height:100vh;
background-size:cover;
background-color:cadetblue;
background-position:center;
.logo {
width:100px;
height:70px;
float: left;
position: relative;
.navbar {
width:85%;
margin:auto;
padding: 35px 0;
display: flex;
align-items:center;
justify-content:space-between;
color:white;
font-size:30px;
.navbar p {
margin-left:-200px;
.navbar ul li{
list-style:none;
display:inline-block;
margin: 0 20px;
.navbar ul li a{
text-decoration:none;
color:white;
.navbar ul li a:hover{
color:yellow;
.navbar a {
float: left;
font-size: 24px;
color: white;
text-align: center;
text-decoration: none;
.dropdown {
float: left;
overflow: hidden;
/* Dropdown button */
.dropdown .dropbtn {
font-size: 24px;
border: none;
outline: none;
color: white;
background-color: inherit;
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
z-index: 1;
.dropdown-content a {
float: none;
color: black;
text-decoration: none;
display: block;
text-align: left;
.dropdown-content a:hover {
background-color: #ddd;
.dropdown:hover .dropdown-content {
display: block;
.main p{
margin-top:50px;
margin-bottom: 50px;
font-weight:bold;
font-size:28px;
OUTPUT:
4. Design below form using HTML5
-City is drop down list with multiple city names
-Name, mobile number, address are mandatory fields. If any of these field is empty, after clicking
submit button, it should show like this.
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Visitor Form</title>
</head>
<body>
<div class="register">
<td>Name</td>
<td>
<input
type="text"
name="Name"
id="name"
required
/><br />
</td>
</tr>
<tr>
<td>
Gender
Male
Female
</td>
</tr>
<tr>
<br />
<td>Mobile Number</td>
<td>
<input
type="number"
name="Mnum"
id="num"
/>
<br />
</td>
</tr>
<tr>
<td>Address</td>
<td>
<input
type="text"
name="address"
id="address"
/><br />
</td>
</tr>
<tr>
<td>City</td>
<option value="Chandigarh">Chandigarh</option>
<option value="Delhi">Delhi</option>
<option value="Varanasi">Varanasi</option>
</select>
<br />
</tr>
<tr>
<td id="knowledge">How do you come to know about us</td>
Tv news
Internet
</tr>
<br /
<tr>
</td>
</tr>
</form>
</div>
</body>
</html>
Style.css
body {
text-align: center;
margin: 0;
font-family: verdana;
font-size: 15px;
h1 {
font-size: 40px;
}
table,
th,
td {
td,
th {
padding: 10px;
#divRegister {
margin: 10px 0 0 0;
#Name {
margin-left: 46px;
#Gender {
margin-left: -12px;
padding-right: 56px;
#Address {
margin-left: 12px;
#divFooter {
input,
select,
button {
margin: 0.5% 0;
}
#knowledge {
padding: 5px;
Output :
5. Problem Description
1. To Create this HTML Application, create a folder called TestCSS.
3. In the body tag, create a table with header, table rows and table data.
5. Use any png image as background to table header with border radius of 6px.Refer to output
for color, height, width and font-size.
7. For table data provide border of 1 px dotted and padding of 15px, width 100px, refer to other
properties and background color as in output
TableWithCSS.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<tr>
<td>
<center>
</center>
</td>
</tr>
</table>
<tbody>
<tr>
<center>
<th>Name</th>
<th>Gender</th>
<th>Mobile Number</th>
<th>Address</th>
<th>City</th>
<th>Country</th>
</tr>
<tr>
<td >zdev</td>
<td >MALE</td>
<td >9214143454</td>
<td >Varanasi</td>
<td >india</td>
</tr>
<tr>
<td >zdev</td>
<td >MALE</td>
<td >9214143454</td>
<td >Varanasi</td>
<td >india</td>
</tr>
<tr>
<td >zdev</td>
<td >MALE</td>
<td >9214143454</td>
<td >Varanasi</td>
<td >india</td>
</tr>
<tr>
<td >zdev</td>
<td >MALE</td>
<td >9214143454</td>
<td >Varanasi</td>
<td >india</td>
</tr>
<tr>
<td >zdev</td>
<td >MALE</td>
<td >9214143454</td>
<td >Varanasi</td>
<td >india</td>
</tr>
</center>
</tbody>
</table>
</body>
</html>
Style.css
.table-img img {
border-radius: 6px;
height: 30%;
width: 30%;
.table-data th {
width: 100px;
padding: 15px;
background-color: #e20e0e;
border-spacing: 0px;
.table-data td {
background-color: aqua;
6. Problem Description ()
3. In the body tag create a form and table as shown in sample output with the labels and input
types as shown.
5. 1.Disconnection Problem
2.Phone Dead
3.Other
6. Create a TelephoneComplaint.css file and define the CSS properties here as per sample output
3. Use internal JS and define a function called buildPyramid with the number of rows as
parameter
Sample output 1:
<!DOCTYPE html>
<html>
<head>
<script>
function pyramid(n) {
pyramid(5);
</script>
</head>
<body>
</html>
Sample Output 2:
<!DOCTYPE html>
<html>
<head>
<script>
function pyramid(n) {
pyramid(6);
</script>
</head>
<body>
</body>
</html>
8. Problem Description
For this Application, use the existing application TelephoneComplaint.html created in folder
Telephone under section 4.3
Detailed Complaint Description box should be disabled initially, and when user chooses Other
option in Nature of Complaint, Description box should get enabled and get disabled when a
subscriber changes the Nature Of Complaint to something else. (Disconnection Problem/Phone
Dead).
Complaint raised date should be current date and shouldn’t be changed, it should be readyonly
and the date should be populated as soon as the form loads in browser.
Experiment - 8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Telephone Complaint</title>
<style>
body {
background-color: #5f5f60ba; }
label {
display: inline-block;
width: 204px;
text-align: left;
margin: 5px;
padding: 8px;
.label {
border-width: 2px;
border-radius: 5px;
margin: 5px;
padding: 7px;
width: 221px;
#Business {
text-align: right;
.Tab {
margin-left: 14.65em;
.maindiv {
width: 500px;
margin: auto;
border-radius: 10px; }
.sub {
margin-left: 14.5em;
width: 10px;}
#Submit:hover {
}
#detailed {
width: 218px;
height: 55px;}
#ddlModels {
width: 236px;}
.Heading {
margin-left: 400px;
padding-left: 75px;}
</style>
</head>
<body>
<div class="Heading">
</div>
<div class="maindiv">
<div class="Label">
</div>
<br>
<div class="Label">
</div>
<br>
<div class="Label">
<label for="Address">Address</label>
</div>
<br>
<div class="Label">
</div>
<br>
<div class="Label">
</div>
<br>
<div class="Label">
<br>
<div class="Tab">
</div>
</div>
<br>
<div class="Label">
<option value="1">Select</option>
<option value="2">Home</option>
<option value="3">Office</option>
<option value="4">Other</option>
</select>
</div>
<br>
<div class="Label">
</div>
<br>
<div class="Label">
</div><br>
<div class="sub">
</div>
</form>
</div>
</body>
<script>
function EnableDisableTextBox(ddlModels) {
if (!detailed.disabled) {
detailed.focus();}}
function formValidation() {
Subscribername.focus();
return false;
if (Register_mobile.value.length != 10) {
Register_mobile.focus();
return false; }
function ValidateEmail(inputText) {
if (Register_email.value.match(mailformat)) {
return true; } }
return true;}
</script>
</html>
9. Problem Description
Zip codes consist of 5 consecutive digits. Given a string, write a JavaScript function
isValid(zipCode) to determine whether the input is a valid zip code.
Examples:
isValid("59001") ➞ true
isValid("853a7") ➞ false
isValid("393939") ➞ false
Solution Code :
if (zipCode.length !== 5) {
return false}
return zipCodeRegex.test(zipCode)}
console.log(true)
} else {
console.log(false)}}
main()
A group of friends have decided to create a secret code which will be used to login their
application. This code will be the first letter of their names, sorted in alphabetical order and
count of group members.
Create a function that takes in an array of names and returns the secret code.
Examples:
Note
Solution :
if (!Array.isArray(names))
sortedNames.forEach((name) => {
code += name.charAt(0).toUpperCase()})
code += names.length;
return code;}
2. Create a HTML file called dom.html with hyperlink for the paragraph text
3. “[On mouse hover here bold words of the following paragraph will be highlighted]”
4. Include 2 events onMouseOver and onMouseOut for the above hyperlink. For onMouseOver
define a function highlight() and for onMouseOut define a function return_normal.
5. Include the other paragraph having bold(strong) and non bold text as in output.
7. Define following functions in dom.js such that when window loads, it invokes function
getBold_items().
8. getBold_items() gets all the bold tags with tagname strong and stores it.
9. highlight() iterates all stored bold tags and changes color to red.
10. return_normal() makes all highlighted words dark once the mouse is moved out from
hyperlink
11. Open the html application in browser or run in LiveServer with URL
http://127.0.0.1:5500/dom.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a href = "#Para " id="e"> [On mouse hover here bold words of the following paragraph will be
highlighted] </a>
<p><b id = "Para">We</b> have just started <b id = "Para2">this</b> section for the users (<b
id = "Para3">beginner</b> to intermediate) who <b id = "Para4">want</b> to work with <b id =
"Para5">various</b> JavaScript <b id = "Para6">problems</b> write scripts online to <b id =
"Para7">test</b> their JavaScript <b id = "Para8">skill</b>. </b>
</body>
<script>
function mouseOver() {
document.getElementById("Para").style.color = "red";
document.getElementById("Para2").style.color = "red";
document.getElementById("Para3").style.color = "red";
document.getElementById("Para4").style.color = "red";
document.getElementById("Para5").style.color = "red";
document.getElementById("Para6").style.color = "red";
document.getElementById("Para7").style.color = "red";
document.getElementById("Para8").style.color = "red";
function mouseOut() {
document.getElementById("Para").style.color = "Black";
document.getElementById("Para2").style.color = "Black";
document.getElementById("Para3").style.color = "Black";
document.getElementById("Para4").style.color = "Black";
document.getElementById("Para5").style.color = "Black";
document.getElementById("Para6").style.color = "Black";
document.getElementById("Para7").style.color = "Black";
document.getElementById("Para8").style.color = "Black";}
</script>
</html>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<div class="container">
<div class="item-div">
<label for="input"
</label>
</div>
<div class="output">
<ul>
<li>
Milk
<button class="deleteBtn">Delete</button>
</li>
<li>
Veggies
<button class="deleteBtn">Delete</button>
</li>
<li>
Chocolate
<button class="deleteBtn">Delete</button>
</li>
</ul>
</div>
</div>
<script src="./scripts/script.js"></script>
</body>
</html>
Script.js
addBtn.addEventListener("click", function () {
listItemNode.appendChild(listItemText);
var delBtn = document.createElement("button");
delBtn.className = "deleteBtn";
delBtn.appendChild(delBtnText);
listItemNode.appendChild(delBtn);
outputList.append(listItemNode);
input.value = "";});
if (e.target.classList.contains("deleteBtn")) {
let li = e.target.parentNode;
outputList.removeChild(li);}});
style.css
li {
margin: 20px;
As items are entered, it gets added as below with the option to delete
value number,
subject_id number,
student_id number,
department_name varchar(30),
department_block_number number,
student_id number,
student_name varchar(30),
address varchar(40),
city varchar(30),
department_id number,
staff_id number,
staff_name varchar(30),
department_id number,
Ticket_id varchar(4),
Schedule_id varchar(4) ,
User_id int,
No_seats int);
Write a query to display the names of the departments in block number 3 in ascending order.
);
16. Problem Title: Students Name based on Start and Ending Character
Write a query to display the names of the students that start with letter 'A' and end with the
letter 'a', ordered in ascending order.
select * from table where firstname like 'A%' and lastname like '%a'
select columns
from table
where (
select department_block_number
from department
Write a query to display the subjectname, code and staff name who handles that subject,
ordered by code in ascending order.
Code:-
order by staff_name;
from subject
where(staff_id,value
in(select staff_id,max(value)
Write a query to display list of staff name, subject name handled and maximum mark scored
in that subject. Give an alias to the maximum mark as max_mark. Sort the result based on
maximum mark in descending
Solution
From staff st
join subject s
On st.staff_id = s.staff_id
Join marks m
on m.subject_id = s.subject_id
Write a query to create a view for those salesmen belongs to the city New York.
table: salesman
-------------+------------+----------+------------
AS SELECT *
FROM salesman
Create an index named customer_name for the cust_name column of the customer table
Refer the following schema
Soln-
Input
Cust_Name varchar( 30 ) ,
Pincode int(6) ,
Cust_Phone varchar(10)) ;
Write a PL/SQL query to create an ascending sequence called id_seq, starting from 10,
incrementing by 10, minimum value 10, maximum value 100.
INCREMENT BY 10
START WITH 10
MINVALUE 10
MAXVALUE 100
CYCLE
CACHE 2;
Create a new table called tasks with the below DDL query
CREATE TABLE tasks(id NUMBER PRIMARY KEY, title VARCHAR2(255) NOT NULL);
Create a sequence called task_id_seqfor the id column of the tasks table and use it while
inserting records to the tasks table:
Solution:
);
SELECT
id, title
FROM
Tasks;
Output
Create a synonym called stocks for the inventories table and use it in place of the actual table
name in the select query.
Solution:
FOR inventories;
use mysql;
FLUSH PRIVILEGES;
desc mysql.user;
Write a program using Python for accepting your personal details and display the same. You
should read the following values from the console. Use appropriate variable names and types
to represent and store personal details in the memory.
First Name
Last Name
Date of Birth
Address
Phone Number
Refer the below given sample input and output for the formatting specification
Sample Input 1
DOB: 25/12/1990
Address: NYC, US
Phone: 636-48018
Source code:-
print()
print()
print("First name:", f)
print("Last name:", l)
print("Date of Birth", d)
print("Address", a)
print("Phone Number", P)
Write a Python program to convert the given string type to other types such as int and float.
Program
a = '123'
b = '3'
print(type(a))
print(type(b))
a = float(a)
b = int(b)
print(type(a))
print(type(b))
print(a)
print(b)
Write a Python program to create a list of random integers and randomly select multiple items
from the said list. Use random.sample()
CODE :-
print(nums_list)
no_elements = 4
print(result_elements)
no_elements = 8
print(result_elements)
28. Problem Title: Current Date
Write a Python program to import the datetime module and display the current date Program
today = date.today()
Create a class named MyClass, with a property named x. Set some value to x. Later, create an
object named p1, and print the value of x.
class Person:
self.name = name
self.age = age
p1 = Person("John", 36)
print(p1.name)
print(p1.age)
Dog has a method get_energy which returns the amount of energy left.
Code:
class Dog:
def sleep(self):
ei=self.energy+2
return ei
def bark(self):
ec=self.energy-1
return ec
p1 = Dog(10)
print(p1.sleep())
print(p1.bark())
class Person:
self.name = name
self.age = age
p1 = Person("Ishita", 21)
print(p1.name)
print(p1.age)
32. Problem Title: Vehicle Details Create a Vehicle class with name, max_speedand mileage
instance attributes. Create a Bus child class that inherits from the Vehicle class and use all the
instance attributes for capturing the details of a bus and display the same. The method name
can be displaydetails()
Solution:
class Vehicle:
self.max_speed = max_speed
self.mileage = mileage
class Bus(Vehicle):
def displaydetails(self):
pass
School_bus.displaydetails()
33. Write a Python program to get a string made of the first 2 and the last 2 chars from a
given a string. If the string length is less than 2, return instead of the empty string.
Sample Input 1
'w3resource'
Sample Output 1
'w3ce'
Sample Input 2
'w'
Sample Output 2
Empty String
CODE:
def string_both_ends(str):
if len(str) < 2:
return ''
print(string_both_ends('w3resource'))
print(string_both_ends('w3'))
print(string_both_ends('w'))
34. Problem Title: Swapping the Elements of a List Given a list in Python and provided the
positions of the elements, write a program to swap the two elements in the list.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
[1, 5, 3, 4, 2]
35. Problem Title: Min and Max in the Set Write a Python program to get the maximum and
minimum element in a set, using the built-in functions of Python
CODE:
def MIN(sets):
return(min(sets))
def MAX(STES):
return(max(sets))
# Driver Code
Output:
Sample Input
set = ([8, 16, 24, 1, 25, 3, 10, 65, 55])
Sample Output
36. Problem Title: Number and its Cube using Tuple Given a list of numbers of list, write a
Python program to create a list of tuples having first element as the number and second
element as the cube of the number.
Sample Input
list = [9, 5, 6]
Sample Output
list1 = [9,5,6]
print (res)
37. Problem Title: Sum of Elements in the Dictionary Given a dictionary in Python, write a
Python program to find the sum of all Items in the dictionary.
Sample Input 1
Sample Output 1
600
Sample Input 2
Sample Output 2
88
OUTPUT:
Code:
dict={"x":69,"y":420,"z":6969}
values=dict.values()
total=sum(values)
print(total)
38. Problem Title: Reverse the Order Write a Python program to reverse the order of
the elements in the given array.
Create an array with the below given elements.
Sample Output
3, 9, 1, 7, 3, 5, 3, 1
CODE
print(arr[i]),
print(arr[i]),
39. Problem Title: Element Count Write a Python program to get the number of
occurrences of a specified element in an array. If the specified element not found in the
given array, then display “Not Found” message.
Create the array with the below elements.
Sample Input 1
Sample Output 1
Number of occurrences of the number 3 in the array: 3
Sample Input 2
Sample Output 2
Not Found
CODE:
lst = [1,3,5,3,7,9,3]
count=lst.count(h)
if h in lst:
else:
print("Not found")
40. Problem Title: Insert Element at Specified PositionWrite a Python program to insert
a new item before the second element in an existing array.
Create the array with the below elements.
Sample Input 1 4
Sample Output 1 1, 4, 3, 5, 7, 9
ANSWER :
Python code :
array_num.insert(1, 4)
print("New array: "+str(array_num))
Sample Output:
41. Problem Title: List Total Write a Python function to sum all the numbers in a list.
Code :
mylist=[8, 2, 3, 0, 7]
sum=0
sum += mylist[0]
sum += mylist[1]
sum += mylist[2]
sum += mylist[3]
sum += mylist[4]
Sample Output 20
42. Problem Title: Prime Checker Write a Python function that takes a number as a
parameter and check the number is prime or not. The function should return a Boolean value.
Call the above function and display “x is a Prime Number” if the function returns true, else
display “x is not a Prime Number”
Note: A prime number (or a prime) is a natural number greater than 1 and that has no positive
divisors other than 1 and itself.
Sample Input 1
Sample Output 1
5 is a Prime Number
Sample Input 2
12
Sample Output 2
PROGRAM
def prime(x):
if (x % i) == 0 :
return True
break
else :
return False
if prime(x) == True :
else :
1st output ::
5 is a prime number
2nd output ::
43. Problem Title: Work with Modules bPerform the following tasks in this exercise,
Load the osModule
import os
cwd = os.getcwd()
import os
cmd = 'date'
os.system(cmd)
import time
Seconds = 1545925769.9618232
Local_time = time.ctime(seconds)
Call its functions to get the date, hour, minute and second.
datetime_object = datetime.now()
print(datetime_object)
print('Type :- ',type(datetime_object))
import math
a = math.pi / 6
print (math.sin(a))
Create your own module called greeting with the function sayhello()
def greet(name):
greet('Raj')
greet(998)
Birds.py
class Birds:
def __init__(self):
def printMembers(self):
Mammals.py
class Mammals:
def __init__(self):
def printMembers(self):
__init__.py
myMammal = Mammals()
myMammal.printMembers()
myBird = Birds()
myBird.printMembers()
ar1 = np.zeros(10)
ar2 = np.ones(10)
ar3 = np.ones(10)*5
print("array of 1: ",ar2)
print("array of 5: ",ar3)
ars = np.concatenate(arfin)
print(ars)
46. Problem Title: Write a NumPy program to compute sum of all elements, sum of
each column and sum of each row of a given array.
PROGRAM:
import numpy as np
x = np.array([[0,1],[2,3]])
print("Original array:")
print(x)
print("Sum of all elements:")
print(np.sum(x))
print(np.sum(x, axis=0))
print(np.sum(x, axis=1))
OUTPUT:
Original array:
[[0 1]
[2 3]]
[2 4]
[1 5]
Sample Output
[[2 2 2 2 2]
[2 2 2 2 2]
[2 2 2 2 2]]
[[2 2 2 2 2]
[2 2 2 2 2]
[2 2 2 2 2]]
Code-
import numpy as np
print(x)
print(y)