0% found this document useful (0 votes)
37 views21 pages

LAB PSAP Problem Statements

Uploaded by

Sanket Karade
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)
37 views21 pages

LAB PSAP Problem Statements

Uploaded by

Sanket Karade
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/ 21

FY-PSAP LAB EXAM AY:2023-24 SEM-I

E01
Given a string, S , consisting of alphabets and digits, find the number of
alphabets and digits in the given string.
Test Case 1:
Sample Input: a11472o5t6

Number of digits: 7

Number of alphabets:3

E02
Given a string s containing just the characters like:
'(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if number of opening and closing brackets is same
(irrespective of the sequence of opening and closing brackets)
Test Case 1:
Sample Input: ( )
Sample Output: Valid

Test Case 2:
Sample Input: ( )[ ]{ }
Sample Output: Valid

Test Case 3:
Sample Input: ( [ { }
Sample Output: Invalid
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E03
Given a string s, perform following operations on a string using function
(Without pointer):
1. Find a length of a string.
2. Print string in reverse order.
3. Copy string s into s1 and print it.
4. Accept another string, say s2. Concatenate s and s2 and print
concatenated string.

E04
Given a string s, perform following operations on a string using function
(With pointer):
1. Find a length of a string.
2. Print string in reverse order.
3. Copy string s into s1 and print it.

E05
Given a string s, return true if it a Palindrome or false otherwise.
Test Cases:
Case 1:
Input: MADAM
Output: true
Case 2:
Input: CAR
Output: false
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E06
Accept limit of array from user. As per the limit, read integer elements in
array. Then print :
1. Minimum, Maximum number from array.
2. Search for a particular number from array.

E07
You are given a string s and an integer array index of the same length. The
string s will be shuffled such that the character at the ith position moves
to indices[i] in the shuffled string.
Return the shuffled string.

Test Cases:
Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3]
Output: "leetcode"
Explanation: As shown, "codeleet" becomes "leetcode" after shuffling.

Input: s = "abc", indices = [0,1,2]


Output: "abc"
Explanation: After shuffling, each character remains in its position.
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E08
1. Write a Program to print the output like:
A
A B
A B C
A B C D
A B C D E
A B C D
A B C
A B
A
2. Write a program to print factorial of 1 to 10 numbers.

E09
1. Write a Program to print the output like:

1
12
123
12345
E D C B A
E D C B
E D C
E D
E
FY-PSAP LAB EXAM AY:2023-24 SEM-I

2. Write a program to print prime numbers between two numbers given


by user.

E10
Write a C program to find the frequency of each character in a string.
Test Cases: String: This book is very good
Frequency of T:1
Frequency of h:0
Frequency of o:4 and so on for every distinct character.

E11
Write a C program to print Fibonacci series up to n
terms.

Test Cases: No. of terms 10


Output: 0,1,1,2,3,5,8,13,21,34
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E12
Write a C program to count the number of Vowels and

Consonants.

Test Cases: String: C is a programming language.

Vowels: 9

Consonants: 14

E13
Write a program to convert decimal to binary
number.
Test Cases:
Input : 5
Output: 101
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E14
Write a C program to reverse an array using
pointers.
E15
Write a function to print all perfect numbers in a
given interval in C programming.

Test Cases:1) Enter lower limit to print perfect numbers:1


Enter Upper limit to print perfect numbers:10000
All perfect numbers between 1 to 10000 are:
6,28,496,8128
2) Enter lower limit to print perfect numbers: 23
Enter upper limit to print perfect numbers: 450
All perfect numbers between 23 to 450 are:
28
3) Enter lower limit to print perfect numbers: 15
Enter upper limit to print perfect numbers: 70
All perfect numbers between 15 to 70 are: 28
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E16
Write a C Program to read and print name and
other details like mobile number, marks of 5
subjects of n number of students using
Structure. Print data of top 5 students ( top 5
should be calculated based on the entered
marks)

E18
Write a C program to store student data(roll no, name,
marks of 5 subjects) in structure. Then calculate the
grade of a student using a logical operator.

(76-99 Distinction
60-75 First Class
50-59 Second Class
40-49 Pass Class
Below 40 Fail)
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E19

Write a c program for swapping of two arrays using


call by value function.
E20
Write a C program to count the number of digits in
an integer. Then print addition of all digits in the
given number.

Test Cases:
1) input: 671041

output:
Number of digits:6
Addition of digits:19
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E21

1. Find the sum of two one-dimensional arrays


using Dynamic Memory Allocation and functions.
Array should be passed as a function argument and
in function should perform addition of passed
arrays.

E22

Perform following operations on 2D Matrix:


2. Accept number of rows and columns of two
matrices and read elements of both matrices.
3. Print Transpose of both matrices.
4. Print Diagonal elements of both matrices.
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E23
Create a structure named Date having day, month
and year as its elements.
Store the current date in the structure. Now add 45
days to the current date and display the final date.

Test Cases:
Input : dd mm yy (e.g 6 /3/23)
Output: dd/mm/yy (20/4/23)

E24
Write a structure to store the roll no., name, age
(between 11 to 14) and address of students (5
students). Store the information of the students.

1 - Write a function to print the names of all the


students having age 14.
2 - Write a function to print the names of all the
students having even roll no.
3 - Write a function to display the details of the
FY-PSAP LAB EXAM AY:2023-24 SEM-I

student whose roll no is given (i.e. roll no. entered


by the user).

E25
Write a structure to store the names, salary, and hours
of work per day of 10 employees in a company. Write a
program to increase the salary depending on the number
of hours of work per day as follows and then print the
name of all the employees along with their final
salaries. Assume:

Hours of work per day 8 10 >=12


Increase in salary ₹4000 ₹8000 ₹12000
Test Cases: Input
A 40000 8
B 10000 10
C 60000 14
Output:
A 44000 8
B 18000 10
C 72000 12
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E26
Write a C program to read the first line from a file.
Test Cases: Suppose the program.txt file contains
the following text in the current directory.
Java is Object Oriented Programming.
How are you?
Welcome to VIT
Output: Java is Object Oriented Programming.
E27
Write a C program to create a student database
using file.
Perform following operations:
1. Open file
2. Write five records in file.
3. Read all five records from file.
FY-PSAP LAB EXAM AY:2023-24 SEM-I

4. Search for a particular student from file and


print his/her details.
E28

Write a C program to copy one file contents to


another file using character by character. Consider
a small source file of 4-5 lines only.
E29
Perform following operations on 2D Matrix:
5. Accept number of rows and columns of two
matrices and read elements of both matrices.
6. Print Transpose of both matrices.
7. Print Addition of two matrices.
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E30
Accept number of rows and columns and read elements of matrix.
1. Print matrix in row major format.
2. Print matrix in column major format.
Test Case 1:
Number of rows:2
Number of columns: 3
Matrix Elements: 1 2 3 4 5 6
Row Major:
1 2 3
4 5 6
Column Major
1 3 5
2 4 6
FY-PSAP LAB EXAM AY:2023-24 SEM-I

E31

Write a C Program to count number of characters in the file and


print every character on new line on screen.
E32
Write a c program to Delete all occurrences of Character from the
String.
Test case: Computer_engineering
Enter character to delete: e
Output: Computr_nginring
E33
Write a c program to insert a sub-string in to given main string.

Enter First String: Life is beautiful


Enter Second String: very
Enter the position to insert second string in first: 9
Output: Life is very beautiful

E34
FY-PSAP LAB EXAM AY:2023-24 SEM-I

1. Write a C program to print a given string in upper case using


C
2. Write a C program to Reverse a string using pointers
E35
1. Write a C program to evaluate a^b using function.

2. Write a C program to find out the maximum number in an


array using function.
E36
Write a C program to find HCF and LCM of two numbers given by
user.
E37
Write a C program to accept two matrices and check if they are
equal or not. Order of both matrices must be accepted from user at
run time.

E38
1. Write a C program to insert a given number in the array at
given position.
2. Write a C program to remove a number in the array from a
given position.

E39
FY-PSAP LAB EXAM AY:2023-24 SEM-I

Write a c program for swapping of two arrays using function and


check if both arrays are equal or not. Limits and numbers of both
arrays must be accepted from user at run time.

E40
Write a C program for swapping of two string
E41
Write a C program for sorting list of elements using bubble sort.
E42
Write a C program for sorting list of elements using selection sort
E43
Write a C program to search element in given list using linear
search . also find largest element in given array.
E44
Write a C program to find duplicate element in an array.

E45
Write a C program to insert element in an array on given specific
position.
FY-PSAP LAB EXAM AY:2023-24 SEM-I

OTHER THAN THIS LIST:


selected problem set from Geeks for Geeks.
as per my experience, I have selected these problems for your lab
exam
I got 89 marks in PSAP and 88 in DSA in my first year

Easy problems
1) length of String
2) palindrome number (hint: reverse and compare with original
one)
3) create a structure with student roll no, name, and cgpa
4) gcd of two numbers
5) reverse string
6) factorial of number
7) table of given number
FY-PSAP LAB EXAM AY:2023-24 SEM-I

8) prime number check


9) largest element in three num
10)leap year

Moderate problems
9) linear search
1) find the largest element in an array
2) remove duplicates (both 1&2 you will get on the college wallah
playlist)
3) create file, write in file, read in file
4) frequency of a character in the string
5) reverse num
6) Armstrong number
7) Fibonacci series
8) binary to decimal conversion and vice versa

hard problems
FY-PSAP LAB EXAM AY:2023-24 SEM-I

1) matrix multiplication
2) simple calculator using switch cases
3) Pascal triangle
4) find the second-largest element in the array
5) rotate the array by k elements
6) move all zeros at the end of the array
7) combination of two elements

https://www.geeksforgeeks.org/c-programming-examples/
if you do these problems honestly, you will able to solve any type
of questions given to you

You might also like