0% found this document useful (0 votes)
17 views74 pages

Computer Practical Qusetion 2

Uploaded by

nzf94jz6t8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views74 pages

Computer Practical Qusetion 2

Uploaded by

nzf94jz6t8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 74

Function Questions

QUESTION 1:- Write a program in Python using function to input a Sentence and Create
a new Sentence storing each of the word in its reverse form
E.g.: - “Input Board exams are coming”
Output: draoB Smaxe era ghimoc
QUESTION 2:- Define a function check (List) where Lst is a list argument to the function
that carries a set of 3 digit numbers. The function picks-each number and interchanges
the 1st digit with the 3rd digit of the number and prepare a new list of those numbers
who remain the same as their previous form after the interchange
E.g.:- old list: [121, 134, 456, 666, 767]
new list: [121, 666, 767]
QUESTION 3:- Define a function func (S, W) Sentences S and ward W. Now search the
word in sentence and add each occurrence of the word as values of a dictionary and Key
as the index where they found.
Example: - input: "He is such a boy who is very good in Studies”, “is”
Dictionary contents: {3: 'is', 21:’is’}
QUESTION 4:- write a function Salary () that takes input a dictionary and displays only
those elements whose salaries are > 56000.
Dictionary Structure {1: [‘John’, 48000], 2: ['Smith', 58000] }
QUESTION 5:-write a function that takes a Sentence and input a sent Convert each word
of the sentence to uppercase which are in Converted in lowercase display the converted
words.
Example: - Input: HELLO how are YOU
Output: HOW ARE
QUESTION 6:- Write a Function to find maximum and minimum elements in a tuple
QUESTION 7:- Write a function to calculate the sum and mean of the elements which
are entered by the User.
FILE HANDLING

QUESTION 8:- Write a program in python that defines and calls the following user
defined functions:
ADD() to accept and data of an employee to a csv file ‘record.csv’.Each record consist of
a list with field elements empid,name,salary respectively.
Countr() to count the number
QUESTION 17:- Write SQL commands for the following on the basis of given table
SPORTS:
(i)Display the names of the students who have grade 'C' in either Game 1 or Game 2 or
both.
(ii) Display the names of the students who have same game for both Game 1 and Game
2.
(iii) Display the games taken up by the students, whose name starts with 'A'
QUESTION 18:- Write SQL commands for the following on the basis of given table CLUB:
(a) To show all information about the swimming coaches in the club.
(b) To list names of all coaches with their date of appointment (DATOFAPP) in
descending order.
(c) To display a report, showing coach name, pay, age and bonus (15% of pay) for all the
coaches.
QUESTION 19:- Write SQL commands for the following on the basis of given table
STUDENT1
(a) Select all the Nonmedical stream students from STUDENT1
(b) List the names of those students who are in class 12 sorted by Stipend.
(c) List all students sorted by AvgMark in descending order and amount of stipend
received in a year
SQL
QUESTION 20:-How to create a database and a table
QUESTION 21:- To insert record
QUESTION 22:- To update record
QUESTION 23:- To delete record
QUESTION 24:- To display a record
STACK QUESTION
QUESTION 25:- Python program to implement a stack operation
QUESTION 1:- Write a program in Python using function to input a Sentence and Create
a new Sentence storing each of the word in its reverse form
E.g.: - “Input Board exams are coming”
Output: draoB Smaxe era ghimoc
QUESTION 2:- Define a function check (List) where Lst is a list argument to the function
that carries a set of 3 digit numbers. The function picks-each number and interchanges
the 1st digit with the 3rd digit of the number and prepare a new list of those numbers
who remain the same as their previous form after the interchange
E.g.:- old list: [121, 134, 456, 666, 767]
new list: [121, 666, 767]
QUESTION 3:- Define a function func (S, W) Sentences S and ward W. Now search the
word in sentence and add each occurrence of the word as values of a dictionary and Key
as the index where they found.
Example: - input: "He is such a boy who is very good in Studies”, “is”
Dictionary contents: {3: 'is', 21:’is’}
QUESTION 4:- write a function Salary () that takes input a dictionary and displays only
those elements whose salaries are > 56000.
Dictionary Structure {1: [‘John’, 48000], 2: ['Smith', 58000] }
QUESTION 5:-write a function that takes a Sentence and input a sent Convert each word
of the sentence to uppercase which are in Converted in lowercase display the converted
words.
Dictionary Structure {1: [‘John’, 48000], 2: ['Smith', 58000] }
QUESTION 5:-write a function that takes a Sentence and input a sent Convert each word
of the sentence to uppercase which are in Converted in lowercase display the converted
words.
Example: - Input: HELLO how are YOU
Output: HOW ARE
QUESTION 6:- Write a Function to find maximum and minimum elements in a tuple
QUESTION 7:- Write a function to calculate the sum and mean of the elements which
are entered by the User
QUESTION 8:- Write a program in python that defines and calls the following user
defined functions:
SUPW.
(ii) Display the different games offered in the school.
(iii) Display the SUPW taken up by the students, whose name starts with 'A'
QUESTION:9 Write a programme using two user defined function as follows:

Add sport data(n):to accept n record str and store them into the binary file

‘sports.dat’ storing only if the sport type is “indoor” sportID Sname, Type,Days.
QUSETION 10: Search Sportdata(d):to display all records from the file “Sports.dat”
storing only if the sport type is ‘indoor” and days is above 10.
QUSETION 11: Write a method count line() in python to read lines from the text file
“Textfile.Txt” and display the lines which are not starting with any vowel.
QUESTION 12 : Write a function ETCount() in python, which should read each character
a text file”TESTFILE.TXT” and then count and display the count of the occurnece
alphabet E and T individually(including e and t).
QUSETION 13 : A binary file “dat.dat” contains records of student as per following str
ANO SNAME MARKS
Write a programm to search for student whose number /id is input by the user. If not
found. Appropriate message should be displayed.
QUSETION 14: Write a programme to show updation in studention in student marks as
marks+2 whose marks are greater thean 150.
QUSETION 15: Write a programm to read the content from a txt file “status.txt”
Count and display the total number of lines and blanks spaces presnt in it.
QUSETION 16 WRITE SQL COMMANDS for the following on the basis of given table
STUDENT:
(i) Display the names of the student who are getting a grade “C” in either GAME
or SUPW.
(ii) Display the different games offered in the school.
(iii) Display the supw taken up by the student , whose name starts with “A”
QUESTION 17:- Write SQL commands for the following on the basis of given table
SPORTS:
(i)Display the names of the students who have grade 'C' in either Game 1 or Game 2 or
both.
(ii) Display the names of the students who have same game for both Game 1 and Game
2.
(iii) Display the games taken up by the students, whose name starts with 'A'
QUESTION 18:- Write SQL commands for the following on the basis of given table CLUB:
(a) To show all information about the swimming coaches in the club.
(b) To list names of all coaches with their date of appointment (DATOFAPP) in
descending order.
(c) To display a report, showing coach name, pay, age and bonus (15% of pay) for all the

coaches
QUESTION 20:-How to create a database and a table
QUESTION 21:- To insert record
QUESTION 24:- To display a record
QUESTION 22:- To update record

QU
QUESTION 23:- To delete record
Delete from student where name=”AYUSH”;
QUESTION 25:- Python program to implement a stack operations

You might also like