Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views10 pages

Syllabus Copy

Download as odt, pdf, or txt
Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1/ 10

21CS215B: JAVA PROGRAMMING LAB

LIST OF EXPERIMENTS

1) Use eclipse or Netbean platform and acquaint with the various menus,
create a test project, add a testclass and run it see how you can use auto
suggestions, auto fill. Try code formatter and code refactoringlike
renaming variables, methods and classes. Try debug step by step with a
small program of about 10 to15 lines which contains at least one if else
condition and a for loop.

2) Write a java program to demonstrate mutability of StringBuffer class to


find out whether a givenstring is Palindrome or not?

3) Write a program to create a user defined package named ‘sample’ and


demonstrate importing thispackage in other program.

4) Write a Java program that works as a simple calculator. Use a grid


layout to arrange buttons for thedigits and for the +, -,*, % operations. Add
a text field to display the result. Handle any possibleexceptions like divide
by zero.

5) a) Develop an applet that displays a simple message.


b) Develop an Applet that receives an integer in one text field & compute
its factorial value & returnsit in another text filed when the button
“Compute” is clicked

6) Write a program that creates a user interface to perform integer


divisions. The user enters twonumbers in the text fields, Num1 and Num2.
The division of Num1 and Num2 is displayed in the Resultfield when the
Divide button is clicked. If Num1 or Num2 were not an integer, the
program would throwa Number Format Exception. If Num2 were Zero, the
program would throw an Arithmetic Exception
Display the exception in a message dialog box

7) Write a java program that implements a multi-thread application that has


three threads. First threadgenerates random integer every 1 second and if
the value is even, second thread computes the square ofthe number and
prints. If the value is odd, the third thread will print the value of cube of
the number.

8) Write a java program that simulates a traffic light. The program lets the
user select one of three lights:red, yellow, or green with radio buttons. On
selecting a button, an appropriate message with “stop” or“ready” or “go”
should appear above the buttons in a selected color. Initially there is no
message shown.

9) Write a java program to create an abstract class and abstract methods

10) Suppose that a table named Table.txt is stored in a text file. The first
line in the file header and theremaining lines correspond to row in the
table. The elements are separated by commas. Write a Javaprogram to
display the table using labels in grid layout.

11) Write a Java program that handles all mouse events and shows the
event name at the center of thewindow when a mouse event is fired. (Use
adapter classes).

12) Write a java program that loads names and phone numbers from a text
file where the data isorganized as one line per record and each field in a
record are separated by a tab (\t).it takes a name orphone number as input
and prints the corresponding other value from the hash table(hint: use hash
tables)

13) Write a java program that correctly implements the producer–


consumer problem using the conceptof inters thread communication.

14) Write a java program to list all the files in a directory including the
files present in all itssubdirectories.
DATABASE MANAGEMENT SYSTEMS LAB

List of Experiments:
1. Concept design with E-R Model
2. Practicing DDL commands
3. Practicing DML commands
4. Relational Model
5. Normalization
6. A. Querying (using ANY, ALL, UNION, INTERSECT, JOIN,
Constraints etc.)
B. Nested, Correlated sub queries
7. Queries using Aggregate functions, GROUP BY, HAVING and Creation
and dropping of
Views.
8. Triggers (Creation of insert trigger, delete trigger, update trigger)
9. Procedures
10. Usage of Cursors

PYTHON PROGRAMMING LAB


Week -1:
1. i) Use a web browser to go to the Python website http://python.org. This
page containsinformation about Python and links to Python-related pages,
and it gives you the abilityto search the Python documentation.
ii) Start the Python interpreter and type help() to start the online help
utility.
2. Start a Python interpreter and use it as a Calculator.
3.i) Write a program to calculate compound interest when principal, rate
and numbers ofperiods are given.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two
points
Week-2:
1. Read name, address, email and phone number of a person through
keyboard and print the details.
2. Write a program to demonstrate different number data types in Python.
3. Write a program to perform different Arithmetic Operations on numbers
in Python.
Week - 3:
1. Print the below triangle using for loop. 5
44
333
2222
11111
2. Write a program to check whether the given input is digit or lowercase
character oruppercase character or a special character (use 'if-else-if'
ladder)
3. Python Program to Print the Fibonacci sequence using while loop
Week-4:
1. Python program to print all prime numbers in a given interval (use
break)
2. Write a python script to print the current date in the following format
“Sun May 29 02:26:23IST 2017”
3. Write a program to create, concatenate and print a string and accessing
sub-string from agiven string.
Week - 5:
1. i) Write a program to convert a list and tuple into arrays.
ii) Write a program to find common values between two arrays.
2. Write a function called gcd that takes parameters a and b and returns
their greatest common divisor.
3. Write a function called palindrome that takes a string argument and
returns True if it is apalindrome and False otherwise. Remember that you
can use the built-in function len tocheck the length of a string.
Week - 6:
1. Write a function called is sorted that takes a list as a parameter and
returns True if the listis sorted in ascending order and False otherwise.
2. Write a function called has a duplicate that takes a list and returns True
if there is anyelement that appears more than once. It should not modify
the original list.
i). Write a function called remove duplicates that takes a list and returns a
new list withonly the unique elements from the original. Hint: they don’t
have to be in the same order.
ii). The wordlist I provided, words.txt, doesn’t contain single letter words.
So you mightwant to add “I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct
a function toinvert its content. i.e., keys should be values and values
should be keys.
3. i) Add a comma between the characters. If the given word is 'Apple', it
should become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and
replaces the first letterof every word with the corresponding upper case
letter and the rest of the letters in theword by corresponding letters in
lower case without using a built-in function?
Week-7:
1. Writes a recursive function that generates all binary strings of n-bit
length
2. Write a program to define a lambda function(rev_upper) to convert a
string to it’s upper-case and reverse it.
3. Write a python program to find factorial of a number using Recursion.
Week - 8:
1. i) Write a python program that defines a matrix and prints
ii) Write a python program to perform addition of two square matrices
iii) Write a python program to perform multiplication of two square
matrices
2. How do you make a module? Give an example of construction of a
module using differentgeometrical shapes and operations on them as its
functions.
3. Use the structure of exception handling all general purpose exceptions.
Week - 9:
1. Write a Python program to show how to use else clause with try and
except clauses
2. Write a Python Module Program to implement Arithmetic operators,
Bitwise operators, Logical operators in pythonas functions in one module.
3. Write a python program to specify scope and Lifetime of variables in
python Functions.
Week-10:
1. a. Write a function called draw rectangle that takes a Canvas and a
Rectangle asarguments and draws a representation of the Rectangle on the
Canvas.
b. Add an attribute named color to your Rectangle objects and modify
draw rectangle sothat it uses the color attribute as the fill color.
c. Write a function called draw point that takes a Canvas and a Point as
arguments anddraws a representation of the Point on the Canvas.
d. Define a new class called Circle with appropriate attributes and
instantiate a fewCircle objects. Write a function called draw circle that
draws circles on the canvas.
2. Write a Python program to demonstrate the usage of Method Resolution
Order (MRO) inmultiple levels of Inheritances.
3. Write a python code to read a phone number and email-id from the user
and validate itfor correctness.

Week- 11
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to
check for given wordspresent in it and display on found.
3. Write a Python code to Read text from a text file, find the word with
most number of occurrences
Week - 12:
1. Import numpy, Plotpy and Scipy and explore their functionalities.
2. a) Install NumPy package with pip and explore it.
3. Write a program to implement Digital Logic Gates – AND, OR, NOT,
EX-OR
Week - 13:
1. Write a program to implement Half Adder, Full Adder, and Parallel
Adder
2. Write a GUI program to create a window wizard having two text labels,
two text fields andtwo buttons as Submit and Reset.
3. Write a function that reads a file file1 and displays the number of words,
number ofvowels, blank spaces, lower case letters and uppercase letters.
Week - 14:
1. Write a script named copyfile.py. This script should prompt the user for
the names of twotext files. The contents of the first file should be input and
written to the second file.
2. Write a GUI program to create a window for calculator and implement
basicarithmetic operations in that window.
3. Write a python program to perform addition of two matrices using
NUMPY package

PROGRAMMING FOR PROBLEM SOLVING LAB

WEEK-1:
a. Write a C program to find simple interest and compound interest.
b. Write a C program to convert Celsius to Fahrenheit.
c. Write a C Program to swap two numbers.
d. Write a C program to perform all arithmetic operations (+, -, *, / , %).
e. Write a simple program that prints the results of all the operators
available in C(Including pre/ post increment, bitwise and/or/not , etc.).
Read required operandValues from standard input.

WEEK-2:
a. Write a simple program that converts one given data type to another
using autoConversion and casting. Take the values from standard input.
b. Write a C program to check whether the given number is even or odd
using ConditionalOperator.
c. Write a C program to find the Largest of two numbers.
d. Write a C program to print ascending order of three given integers.

WEEK-3:
a. Write a C program to Check the given year is leap year or not.
b. Write a C program to find the roots of quadratic equation.
c. Write a C Program to implement arithmetic calculator using switch case.
d . Write a program that declares Class awarded for a given percentage of
marks,where (use else if ladder and switch) <40%= Failed, 40% to <60%
= Second class, 60% to<70%=First class, >= 70% = Distinction. Read
percentage from standard input.

WEEK-4:
a. Write a program that prints a multiplication table for a given number and
the number of rowsin the table. For example, for a number 5 and rows = 3,
the output should be:
5x1=5
5 x 2 = 10
5 x 3 = 15
b. Write a program that shows the binary equivalent of a given positive
numberbetween 0 and 255.
c. Write a C program to find sum of individual digits of the given integer.
d. Write a C program to find factorial of a given number.

WEEK-5:
a. Write a program that finds if a given number is a prime number
b. Write a C program to check whether the given number is palindrome or
not.
c. Write a C program to print Fibonacci series.
d. Write a C program to read in two numbers, x and n, and then compute
the sum of this geometricprogression: 1+x+x^2+x^3+…… +x^n.
For example: if n is 3 and x is 5, then the program computes 1+5+25+125.

WEEK-6:
a. Write a C program to calculate the following, where x is a fractional
value.1-x/2 +x^2/4-x^3/6.
b. Write a C program to display the prime numbers from 1 to n(where n
value isGiven by user)
c. Write a C program to construct a pyramid of numbers as follows:
1*11*
12**2322**
123***456333***
4444**
*
d. Write a C program to construct the Pascal triangle

WEEK-7:
a. Write a C program to find largest, smallest numbers and average in a list
of arrayelements.
b. Write a C program to find mean, variance, standard deviation for a given
list ofelements.
c. Write a menu driven C program that allows a user to enter n numbers
and then choose betweenfinding the smallest, largest, sum, or average. The
menu and all the choices are to be functions.Use a switch statement to
determine what action to take. Display an error message if an invalid
choice is entered.

WEEK-8:
a. Write a C program to transpose a matrix.
b. Write a C program to perform the Addition of Two Matrices.
c. Write a C program to perform the Multiplication of Two Matrices.

WEEK-9:
Write programs using non recursive and recursive functions for the
following
a. Find GCD.
b. Find the factorial of a given number.
c. Generate the Fibonacci series.
d. Find xn

WEEK-10:
a. Write a C program to swap two integers using following methods.
i. call by value ii. call by reference
b. Write a program for reading elements using a pointer into an array and
display theValues using array.
c. Write a program for display values reverse order from an array using a
pointer.
d. Write a program through a pointer variable to sum of n elements from
an array.

WEEK-11:
a. Write a C program to insert a sub-string into a given main string from a
givenposition.
b. Write a C program to delete n characters from a given position in a
given string.
c. Write a C program to arrange given n strings in alphabetical order.
d. Write a C program to convert a Roman numeral ranging from I to L to
its decimal equivalent.

WEEK-12:
a. Write a C program that converts a number ranging from 1 to 50 to
Roman equivalent
b. Write a C program to determine if the given string is a palindrome or not
(Spelledsame in both directions with or without a meaning like madam,
civic, noon, abcbaetc.)
c. Write a C program that displays the position of a character ch in the
string S or – 1if S doesn‘t contain ch.
d. Write a C program to count the lines, words and characters in a given
text.

WEEK-13:
a. Write a C program to find total and average marks for five subjects of
three students usingstructures.
b. Write a C program to demonstrate nested structures.
c. Write a C program to display the contents of a file to standard output
device.
d. Write a C program which copies one file to another into another file.
e. Write a C program to merge two files into a third file.
(i.e., the contents of the first file followed by those of the second are put in
the third
file)

WEEK-14:
a. Write a C program to reverse the contents of a file.
b. Write a C program that does the following:
It should first create a binary file and store 10 integers, where the file name
and 10 values aregiven in the command line. (hint: convert the strings
using atoi function)
Now the program asks for an index and a value from the user and the value
at that index shouldbe changed to the new value in the file. (hint: use fseek
() function)The program should then read all 10 values and print them
back.
c. Write a C program to count the number of times a character occurs in a
text file. The file nameand the character are supplied as command line
arguments.
d. Write a C program that uses non recursive function to search for a Key
value in aGiven list of integers using linear search method.
e. Write a C program that uses non recursive function to search for a Key
value in a given sortedlist of integers using binary search method.

WEEK-15:
a. Write a C program that implements the Bubble sort method to sort a
given list of integers inascending order.
b. Write a C program that sorts the given array of integers using selection
sort in
c. descending order Write a C program that sorts the given array of
integers using insertion sort inascending order

You might also like