# Section A: Basic Programs: Question A1: WAP to input roll number, name, marks and phone of a student and display

the values. Question A2: WAP to input roll number, name and marks of a student in 5 subjects and calculate the total and average marks. Display all the values. Question A3: WAP to find out the square of a given number. Question A4: WAP to input a number and print its cube. Question A5: WAP to input radius and calculate the area and circumference of a circle. Question A6: WAP to input length and breadth of a rectangle and calculate the area and perimeter. Question A7: WAP to input 4 integers a, b, c, d and check that the equation a3 + b3 +c3 = d3 is satisfied or not. Question A8: WAP to input side of a square and calculate the area. Question A9: WAP to input principle, rate and time from the user and calculate the simple interest and total amount. Display all the values. Question A10: WAP to input the number the days from the user and convert it into years, weeks and days. Question A11: WAP to input a character and print its ASCII value. Question A12: WAP to input a number and print its equivalent character code. Question A13: WAP to find out the quotient and remainder of two numbers. ( Without using modulus ( % ) operator) Question A14: WAP to input two numbers and print their quotient and remainder. Question A15: WAP to input two numbers and print the greatest using conditional operator. Question A16: WAP to input marks of a student and print the result (pass/fail) using conditional operator. Question A17: WAP to input inches from the user and convert it into yards, feet and inches. Question A18: WAP to find out the area of a triangle. Question A19: WAP to find whether a given number is even or odd using conditional operator. Question A20: WAP to find out the greatest of three numbers using conditional operator. Question A21: WAP to input choice (1 or 2). If choice is 1 print the area of a circle otherwise print the circumference of circle. Input the radius from user. Question A22: WAP to input a number. If the number is even, print its square otherwise print its cube. Question A23: WAP to input employee code, name and basic salary of an employee and calculate the following values: HRA 40 % of basic salary DA 10 % of basic salary CCA 5 % of basic salary GS Basic + HRA + DA + CCA PF 10 % of GS IT 10 % of GS NS GS – (PF + IT) Display all the values. Question A24: WAP to input the temperature in Fahrenheit and convert it into Celsius and vice versa. Question A25: WAP to swap the values of two integer variables

(a) Using extra variable (b) Without using extra variable Question A26: WAP to print the system date. Question A27: WAP to find the age of a person by the given date of birth. Section B: Programs Based on Control Structures Question B1: WAP to input the marks of a student and print the result (passing marks = 40 %). Question B2: WAP to input the age of a person and check that he is eligible for license for not. Question B3: WAP to check that a given year is a leap year or not. Question B4: WAP to input a number and check whether it is even or odd. Question B5: WAP to input a number and check that number is divisible by 7 or not. Question B6: According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year is input through the keyboard write a program to find out what is the day on 1 st January of this year. Question B7: WAP to input the name and age of a person and display “CHILD” or “TEENAGER” according to the age. Question B8: WAP to input the salary of a person and calculate the hra and da according to the following conditions: Salary HRA DA 5000-10000 10% 5% 10001-15000 15% 8% Question B9: WAP to input marks in five subjects of a student and calculate the division according to the following conditions: Percentage Division >=60 First 50-59 Second 40-49 Third <40 Fail Question B10: An electricity board charges according to the following rates: For the first 100 units - 40 paisa per unit. For the next 200 units - 50 paisa per unit. beyond 300 units - 60 paisa per unit. All users are charged meter charges also, which are Rs. 50/Question B11: WAP to input monthly salary from the user and calculate the income tax according to the following rules: Salary income tax >=9000 40% of the salary 7500-8999 30% of the salary <7500 20% of the salary Question B12: WAP to input the selling price and cost price from the user and determine whether the seller has made profit or incurred loss. Also display the value of profit or loss. Question B13: WAP to input a character and check that it’s a small letter, capital letter, a digit or a special symbol. Question B14: WAP to input two integers and determine that first is multiple of second. Question B15: WAP to input a character and check that it’s a vowel or a consonant. Question B16: WAP to convert a small letter into capital letter and vice versa.

Question B17: WAP to input the marks of a student in five subjects and calculate the grade according the following conditions: Marks Grade >90 S 76-90 A 61-75 B 51-60 C 40-50 D <40 Fail Question B18: WAP to input the sales made by a salesman and calculate the commission according to the following conditions: Sales Commission 1-10000 4% 10001-20000 5% 20001-30000 6% >30000 7% Question B19: WAP to convert the temperature according to the following conditions: Choice Conversion 1 Fahrenheit to Celsius 2 Celsius to Fahrenheit Question B20: WAP to find out the largest of three numbers. Question B21: WAP to input three numbers and print them in descending order. Question B22: WAP to input a number (1 to 7) and print the weekday name according to the given number. Question B23: WAP to input a digit and print the digit in words. Question B24: WAP to input two numbers and a choice and calculate the result according to the following conditions: Choice Result 1 Add 2 Subtract 3 Multiply 4 Divide 5 Remainder Question B25: WAP to input two numbers and an operator and calculate the result according to the following conditions: Operator Result ‘+’ Add ‘-‘ Subtract ‘*’ Multiply ‘/’ Divide ‘%’ Remainder Question B26: WAP to calculate the area of a circle, a rectangle or a triangle depending upon user’s choice. Choice Area 1 Circle 2 Rectangle

3

Triangle

Question B27: WAP to input the marks in theory and practical and print the result. Question B28: WAP to input a date (dd / mm / yyyy) and check for the validity of the date. Question B29: WAP to print counting from 1 to 10. Question B30: WAP to print counting from 10 to 1. Question B31: WAP to print counting from 51 to 90. Question B32: WAP to find out the sum and average of all the numbers within the given range. Question B33: WAP to print all the numbers falling between 2 numbers entered by the user. Question B34: WAP to print all the even numbers between 1 and 50. Question B35: WAP to print all the odd numbers between 1 and 50. Question B36: WAP to print the sum and average of first n natural numbers. Question B37: WAP to print the sum and average of first n odd numbers. Question B38: WAP to print the sum and average of first n even numbers. Question B39: WAP to print the table of a given number. Question B40: WAP to input 2 numbers and find out the sum of all the even numbers which are not divisible by 5 but divisible by 3 and lies between the given two numbers. Question B41: WAP to input the name and age of a person and print the name as many times as age. Question B42: WAP to print whole screen with any character. Question B43: WAP to print the factorial of a given number. Question B44: WAP to input a number through the keyboard until a ‘.’. Every time a number is entered. The program should display whether it is greater than, less than or equal to the previous number. Question B45: WAP to check that given number is prime or not. Question B46: WAP to input a number and count its even and odd digits and find out their sum separately. Question B47: WAP to generate divisors of an integer. Question B48: If a number 972 is entered through the keyboard, your program should print “Nine Seven Two”. Write the program such that it does this for any positive integers. Question B49: A positive integer is entered through the keyboard, along with it the base of the numbering system in which you want to convert this number. WAP to display the number entered, the base and the converted number. Question B50: WAP to input a number and separate the number in its individual digit and print the digits separated from one another by three spaces each. Question B51: WAP to convert a decimal number to equivalent binary number (fractions also). Question B52: WAP to convert a decimal number to equivalent octal number. Question B53: WAP to convert a decimal number to equivalent hexadecimal number. Question B54: WAP to convert a binary number to the decimal number. Question B55: WAP to convert a octal number to the decimal number. Question B56: WAP to convert a hexadecimal number to the decimal number. Question B57: WAP to convert a octal number to binary number. Question B58: WAP to convert a hexadecimal number to the binary number. Question B59: WAP to generate all combinations of 1, 2 and 3. Question B60: WAP to find out the LCM and GCD of two given numbers. Question B61: WAP to find out the least common divisor of two integers.

Question B62: WAP to check whether square root of a number is prime or not. Question B63: WAP to find out the sum of the following series: (1) 1 + x2/2! + x4/4! + x6/6! + …….xn/n! (2) 1 - x2/2! + x4/4! - x6/6! + …….xn/n! (3) 1 + 1/1! + 1/2! + 1/3! + ……. (4) 1 + 1/1! + 2/2! + 3/3! + ……. (5) x + x2/2! + x3/3! + x4/4! + …….xn/n! (6) x - x2/2! + x3/3! - x4/4! + …….xn/n! (7) 1 + 1/x + 1/x2 + 1/x3 + 1/x4 +……….. (8) x – x3/3! + x5/5! – x7/7! + x9/9! -…….xn/n! (9) 1- 2/21 + 3/31 – 4/41 + 5/51………. (10) 1 + x1/2! + x2/3!...................+ xN/(N+1)! (11) 1 + x/2! + x2/4! + x3/6! + x4/8! +………..xn/(2n)! (12) 1 + x/1! + x3/2! + x5/3! + x7/4! +………..x2n-1/n! (13) 1 + x2/1! + x4/2! + x6/3! + x8/4! +………..x2n/n! (14) 1 - x2/2! + x3/3! – x4/4! + …….xn/n! (15) 1 + x2/2! + x3/3! + x4/4! + …….xn/n! (16) x + x2/3! + x3/5! + x4/7! + x5/9! +…….xn/(2n-1)! (17) x + x3/2! + x5/3! + x7/4! + x9/5! +…….x2n-1/n! (18) x - x2/3! + x3/5! - x4/7! + x5/9! -…….xn/(2n-1)! (19) a + ar + ar2 + ar3+…………+ar(n-1) Question B64: Input two numbers from the keyboard. Write a program to find the value of one number raised to the power of another. Question B65: WAP to print all the ASCII values and their equivalent characters. The ASCII values vary from 0 to 255. Question B66: WAP to check that given number is Armstrong number or not. ( if the sum of the cubes of each digits of the number is equal to the number itself, then the number is called the Armstrong number. For example, 153 = (1*1*1) + (5*5*5) + (3*3*3). Question B67: 145 is a special number, since it satisfies the following relation: 145 = 1! + 4! + 5! = 1+24+120 =145 WAP to print all the numbers of this kind between 1 – 1000000. Question B68: WAP to find out the sum of geometric series. Question B69: WAP to print out all Armstrong numbers between 1 and 500. Question B70: Square of 12 is 144. 21, which is a reverse of 12 has a square 441, which is same as 144 reversed. There are few numbers which have this property. Write a program to find out whether any more such numbers exist in the range of 10 to 100. Question B71: WAP to find out the difference between two dates in terms of numbers of days. Question B72: WAP to input n numbers and calculate the sum, average, maximum and minimum of the given numbers. (use only one variable to input the number and also find the second largest). Question B73: WAP to print the sum of negative numbers, sum of positive even numbers and sum of positive odd numbers from a list of numbers entered by the user. Question B74: WAP to print the largest even number and largest odd number from the list of numbers entered through keyboard. Question B75: WAP to determine all Pythagorean triplets in the range 100 to 1000.

(A Pythagorean triplet is a set of three integers i, j, k such that i2 + j2 = k2) Question B76: WAP to print the following series: (1) 2, 4, 8, 16, 32, 64, 128, 256 (2) 1, 4, 7, 10, …………… 40 (3) 1, -4, 7, -10……………-40 (4) 1, 5, 11, 19, 29 …….. (5) (1)+(1+2)+(1+2+3)+(1+2+3+4)…………..up to n terms (6) (2) + (2+4) + (2+4+6) + (2+4+6+8)………….up to n terms. (7) (1) + (1+3) + (1+3+5) + (1+3+5+7)…………..up to n terms (8) (12) + (12+32)+(12+32+52)+(12+32+52+72)…….up to n terms (9) (22) + (22+42) + (22+42+62)+(22+42+62+82)………up to n terms Question B77: WAP to calculate the root of quadratic equation. Question B78: Write a menu driven program which has following options: 1. Factorial of a number. 2. Prime or Not 3. Odd or even 4. Exit. Question B79: WAP to input a number and print its reverse number. Also check that the number is palindrome or not. Question B80: WAP to input a number and find out the sum of its digits. Question B81: WAP to find out the count of the digits of a given integer. Question B82: WAP to print the Fibonacci series. Question B83: WAP to input a name and print the name in the following pattern R RA RAJ RAJA RAJAT Question B84: WAP to print the following series: 1 12 123 1234 1234 123 12 1 5 54 543 5432 RAJAT RAJA RAJ RA R 1 22 333 4444 4444 333 22 1

54321 A AB ABC ABCD ABCD ABC AB A * ** *** **** ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A 1 2 3 4 5 5 1 0 1 1 0 1 0 4 5 0 0 1 0 1 0 0 0 0 0 3 4 5 1 0 1 0 1 0 1 2 3 4 5 A BB CCC DDDD DDDD CCC BB A **** *** ** *

1

1 0

1 0

1

4

3 3

2 2 2

1 1 1 1

1 1 1 1

2 2 2

3 3

4

A

A B A

A B C B A

A B C D C B A

A B C B A

A B A

A

Question B85: WAP to print the truth table for XY+Z. Question B86: WAP to print the factorial of all the numbers till the given number. Question B87: WAP to print the tables of all the numbers till the given number. Question B88: WAP to input month number and year and print the calendar for the given month. Question B89: WAP to find out the difference between two dates, in terms of days, months and years. Question B90: WAP to add number of days or number of months in a given date. Question B91: WAP to print all the prime numbers till the given number. Section C: Programs Based on Strings Question C1: WAP to count the number of spaces, tabs and new line characters in a given string. Question C2: WAP to input a character and a string. Each occurrence of a character in the string should be converted to opposite case i.e. upper to lower case or vice versa. Question C3: WAP to count the number of words and number of characters in a given line of text except the spaces. Question C4: WAP to input a multi word string and produce a string in which first letter of each word is capitalized. Question C5: WAP to count the numbers of vowels, consonants, digits and special symbols in a given string. Question C6: WAP to count the lower case and upper case letters in a string. Question C7: WAP to search a character in a given string. Question C8: WAP to search a given string into another string and displays the position if found otherwise displays 0. Question C9: WAP to find a substring of given string. Question C10: WAP to extract specified number of characters from a given position from a string. Question C11: WAP to count all the occurrences of a character in a given string. Question C12: WAP to calculate the length of a string. Question C13: WAP to input two strings and print which one is lengthier. Question C14: WAP to reverse a string. Question C15: WAP to check a string for palindrome. Question C16: WAP to copy a string into another string. Question C17: WAP to concatenate two strings. Question C18: WAP to compare two strings. Question C19: WAP to replace every space in a string with a hyphen, tab with a hash and digit with a slash.

Question C20: WAP to input a string and replace every lower case letter with upper case letter, upper case letter with a lower case letter, digit with a ‘#’ and a special symbol with a ‘%’. Display the new string. Question C21: WAP to encrypt and decrypt a string using your own method of encryption and decryption. Question C22: WAP to reverse all the strings stored in an array. Question C23: WAP to swap two strings stored in an array. Question C24: WAP to input 5 strings in an array of strings and display all the strings with their lengths. Question C25: WAP to search a string in the array of strings. Question C26: WAP to display all the palindrome strings from the array of strings. Question C27: WAP to convert a string into upper case and vice versa. Question C28: WAP to extract given number of characters from the left of the string. Question C29: WAP to extract given number of characters from the right of the string. Question C30: WAP to extract given number of characters, from the desired location from the string. Question C31: WAP that will print out all the rotations of a string. For example the rotations of the word “abc” are abc bca cab Question C32: WAP that replaces two or more consecutive blanks in a string by a single blank. Question C33: WAP to input 10 names in a 2D array of characters and replace the 1 st name with 5th name and display the resultant array. Question C34: WAP to input two strings consists of maximum 80 characters. Examine both the strings and remove all the common characters from both the strings. Display the resultant string. Question C35: WAP to test whether a string of opening and closing parentheses is well formed or not. Question C36: WAP to evaluate a postfix expression given by the user. Question C37: WAP to evaluate a prefix expression given by the user. Question C38: WAP to convert a given infix expression to prefix and postfix expression. Question C39: WAP to convert a postfix expression to the prefix expression and vice versa. Question C40: WAP to convert a postfix expression to infix expression. Question C41: WAP to input an arithmetic expression comprising of numeric constants and operators and evaluate the expression at the input. Question C42: Write a function which has two strings x and y as arguments. The function finds out the first symbol of x which does not occur in y. Question C43: Write a program to check that any one of given n strings occur in a string s. Section D: Programs based on arrays Question D1: WAP to input the marks of 10 students in an array of integers and display the marks. Question D2: WAP to search how many times a number is present in an array. Question D3: WAP to subtract two arrays of the same size. Question D4: WAP to input the sales made by a salesman in every month of a given year and find out the total, average, maximum and minimum sales. Question D5: WAP to calculate the average of 10 values stored in an array and display all those values which are more than the calculated average.

Question D6: WAP which finds the locations and values of largest and second largest element in a one dimensional array. Question D7: WAP to reverse an array of floats. Question D8: WAP to create a sorted list using arrays. Every time the element is entered in the array, the array must remain sorted. Question D9: WAP to rotate an integer array towards right by the given number of times. Question D10: WAP to input 20 values in an integer array and count the negative, positive, odd and even values in the array. Question D11: Given an array named A with following elements: 3, -5, 1, 3, 7, 0, -15, 3, -7, -8 WAP to shift the negative numbers to the left and positive numbers to the right so that the resultant array look like the -5, -15, -7, -8, 3, 1, 3, 7, 0, 3 Question D12: WAP to copy the last 5 elements of array B after first 5 elements of array A. Assume length of A and B is greater than 5. Question D13: WAP to print all the palindrome numbers from an integer array and find out their sum. Question D14: WAP to print all the prime numbers from an integer array and find out their sum. Question D15: WAP to input 10 values in a float array and display all the values more than 75. Question D16: WAP delete an element from the array and shift the elements (a) Towards right. (b) Towards left Question D17: WAP to delete all the occurrences of a given value from the array and shift the remaining elements to the left of the array. Question D18: WAP to delete duplicate elements from an array. Question D19: WAP to insert a value in the array at desired location. Question D20: WAP to insert a value in the sorted array. Question D21: WAP to sort an array. • Using bubble sort technique • Using selection sort technique • Using insertion sort technique. • Using Quick sort technique • Using Heap sort technique. Question D22: WAP to check that given array is sorted in ascending / descending order. Question D23: WAP to search a value in the array using • Linear search technique. • Using binary search technique. Question D24: WAP to count the number of occurrences of a given number in an integer array. Question D25: An array consists of 50 integers in the range of 1 to 25, write a program that prints the number of times each integer occurs in the array. Question D26: A, B, C are the arrays of integers of size a, b, a + b, Write a program to produce a third array C containing all the elements of array A and B. Question D27: WAP to merge two arrays according to the following conditions: First array Second array Resultant array

(1) (2) (3) (4) (5) (6)

Ascending Ascending Ascending Ascending Descending Descending

Ascending Ascending Descending Descending Descending Descending

Ascending Descending Ascending Descending Ascending Descending

Question D28: WAP to add and multiply two large integers, which can not be represented by built in data types. QuestionD29: WAP to delete all elements in between and occupying two specified positions. Question D30: WAP to search the first occurrence a given sub array within another array. Question D31: WAP to merge 4 arrays a, b, c, d in one array. All the arrays are in ascending order. Section E: Two Dimensional arrays: Question E1: WAP to input the values in a two dimensional array of integers and display the values. Question E2: WAP to display the values of a two dimensional array in the matrix form. Question E3: WAP to find out the row sum and column sum of a two dimensional array of integers. Question E4: WAP to double all the elements of a matrix. Question E5: WAP to print the left and right diagonal of a square matrix and find out their sum separately. Question E6: WAP to find out the sum of non diagonal elements. Question E7: WAP to display the upper and lower triangle of a matrix. Question E8: WAP to find out the sum and difference of two matrices. Question E9: WAP to find out the product of two matrices. Question E10: WAP to find out the sum of negative, positive, odd and even integers separately from a two dimensional array. Question E11: WAP to display those elements of a two dimensional array which are divisible by 10. Also find their sum. Question E12: WAP to find out the sum of those numbers in the in a 2D array of integers which are divisible by 4 but less than 15. Question E13: WAP to print all the prime numbers from a 2D array and find out their sum. Question E14: WAP to transpose a square matrix. Question E15: WAP to find the inverse of the matrix. Question E16: WAP to find out the sum of the elements above and below the main diagonal of a square matrix. Question E17: WAP to check the equality of two matrices. Question E18: WAP to print all the elements of a square matrix except the diagonal elements. Question E19: WAP to find the maximum, minimum and second maximum of a matrix. Question E20: WAP to sort the elements of a matrix row- wise and column-wise. Question E21: WAP to print squares of diagonal elements of a square matrix. Question E22: WAP which finds the locations and values of largest and second largest element in a two dimensional array.

Question E23: Using a two dimensional array A[n*n], write a program to prepare a one dimensional array B[n2] that will have all the elements of A as if they are stored in column major form. Question E24: Using a two dimensional array A[n*n], write a program to prepare a one dimensional array B[n2] that will have all the elements of A as if they are stored in row major form. Question E25: WAP that receives the month and year from the keyboard as integers and prints the calendar of the given month. ( according to the Gregorian calendar 01/01/1900 was Monday) Question E26: WAP to print the lower half and upper half of a square matrix. Question E27: WAP to construct a magic square. Question E28: WAP to find out the trace of a matrix. Question E29: WAP to compute the determinant of a square matrix of real numbers. Question E30: Sparse Matrix. Section F: Programs based on Functions: Question F1: Write a function that takes one integer argument and returns its square. QuestionF2: Write a function to calculate the cube of a number. Question F3: Write a function to calculate the area of a circle where radius is passed to the function as argument. Question F4: Write a function to calculate the area of a rectangle where length and breadth are passed to the function as argument. Question F5: Write a function that has three arguments principle, rate and time and returns the simple interest. Question F6: Write a function that accepts a character as argument and returns its ASCII value. Question F7: Write a function to swap the values of two integer variables (i) Using Extra variable (ii) Without using extra variable. Question F8: Write a function that has one integer argument and returns 0 if number is even else returns 1. Question F9: Write a function that has one character argument and displays that it’s a small letter, capital letter, a digit or a special symbol. Question F10: Write a function to print the sum and average of first n natural numbers where n is passed to the function as argument. Question F11: Write a function to print the sum and average of first n odd numbers where n is passed to the function as argument. Question F12: Write a function that returns the factorial of a number where number is passed to the function as argument. Question F13: Write a function that returns 1 if the number is prime and 0 if not prime. Number is passed to the function as argument. Question F14: Write a function that prints the sum of the digits, count of the digits and reverse of a number. Number is passed to the function as argument. Question F15: Write a function that returns the sum of the following series where x and n are passed to the function as argument. o 1 + x2/2! + x4/4! + x6/6! + …….xn/n! o 1 - x2/2! + x4/4! - x6/6! + …….xn/n! o 1 + x/2! + x2/4! + x3/6! + x4/8! +………..xn/(2n)!

o 1 + x/1! + x3/2! + x5/3! + x7/4! +………..x2n-1/n! o 1 + x2/1! + x4/2! + x6/3! + x8/4! +………..x2n/n! Question F16: Write a function that has two integer arguments and returns first number raised to the power second number. Question F17: Write a function called zero_small that has two integer arguments being passed by reference and sets the smaller of two numbers to 0. Question F18: Write a function that receives a string (character array) as argument and produces a string in which first letter of each word is capitalized. Question F19: Write a function that receives a string and a character as argument and returns 1 if the character is found in the string else returns 0. Question F20: Write a function to search a given string into another string and returns the position if found otherwise returns 0. Both the strings are passed to the function as argument. Question F21: Write a function to return the length of the string. String is passed to the function as argument. Question F22: Write a function to reverse a string. Question F23: Write a function to search a string in the array of strings. String and array of strings should be passed to the function as parameters. Question F24: Write a function to copy one string into another string. Both the strings are passed to the function as argument. Question F25: Write a function to compare two strings. The strings must be passed to the function as argument. The function should return 0 if the strings are equal else returns 1. Question F26: Write a function to extract given number of characters from the right of the string. String and integer must be passed to the function as argument. Question F27: Write a function to evaluate a prefix / postfix expression. Question F28: Write a function to sort an array using: • bubble sort technique • selection sort technique • insertion sort technique Array is passed to the function as argument. Question F29: Write a function to delete an element from the array. Array, element to be deleted and size of the array are passed to the function as argument. Question F30: Write a function that receives an array and a number as argument and returns number of occurrences of the number in the array. Question F31: Write a function that receives an array and a number as argument and returns 1 if the number is found in the array else returns 0. (Search the number using binary search) Question F32: Write a function that has three arrays a, b, c as arguments of size m, n and m + n respectively. The array a is in ascending order, b is in descending order and function should merge both the arrays and stores them in c in descending order. Question F33: Write a function that receives a 2D array of integers as argument and prints the sum of row elements and column elements separately. Question F34: Write a function to find out the product of two matrices. Matrices are passed to the function as argument. Question F35: Write a function to transpose a square matrix. Matrix is passed to the function as argument. Question F36: Write a function to check the equality of two matrices. Matrices are passed to the function as argument and function returns 1 if they are equal else returns 0.

Section G: Programs based on pointers: Question G1: Write a function to swap the values of two integer variables. The addresses of the variables should be passed to the function as argument. • Using extra variable • Without using extra variable Question G2: Write a function which receives the addresses of two integer variables and returns the address of the variable whichever is greater. Question G3: Write a function that prints the sum of the digits, count of the digits and reverse of a number using a pointer. Address of the number is passed to the function as argument. Question G4: Write a function having one argument of string type and print the string in the following pattern using pointers. R RAJAT RA RAJA RAJ RAJ RAJA RA RAJAT R Question G5: Write a program to print the following patterns using pointers. A AB ABC ABCD ABCD ABC AB A ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A Question G6: Write a function to count the number of spaces, tabs and new line characters in a given string using pointers. The string must be passed to the function as argument. Question G7: Write a function to count the numbers of vowels, consonants, digits and special symbols in a given string using pointers. The string must be passed to the function as argument. Question G8: Write a function to extract specified number of characters from a given position from a string using pointers. The function has one string argument and two integer arguments. Question G9: Write a function to concatenate two strings using pointers. Function has two string arguments. A BB CCC DDDD DDDD CCC BB A

Question G10: Write a function to compare two strings using pointers. Function has two string arguments and returns 0 if strings are equal else returns 1. Question G11: Write a function to encrypt and decrypt a string using pointers and use your own method of encryption and decryption. Question G12: WAP to reverse all the strings stored in an array using pointers Question: Write a function to swap two strings stored in an array using pointers. The array of strings is passed to the function as arguments. Question G13: Write a function to display all the palindrome strings from the array of strings using pointers. The array of strings is passed to the function as arguments. Question G14: Write a function to reverse an array of floats using pointers. The array must be passed to the function as argument. Question G15: Write a function to print all the palindrome numbers from an integer array and find out their sum using pointers. The array must be passed to the function as argument. Question G16: Write a function to delete duplicate elements from the array using pointers. The array must be passed to the function as argument. QuestionG17: Write a function to sort an array using bubble sort technique using pointers. The array must be passed to the function as arguments. Question G18: Write a function to search a value in the sorted array using binary search technique using pointers. The array and value must be passed to the function as argument and function should return 1 if found else returns 1. Question G19: Write a function to find out the row sum and column sum of a two dimensional array of integers using pointers. The array must be passed to the function as argument. Question G20: Write a function to find out the product of two matrices using pointers. The arrays must be passed to the function as argument. Question G21: Write a function to transpose a square matrix using pointers. The array must be passed to the function as argument. Question G22: Write a function to sort the elements of a matrix using pointers. The array must be passed to the function as argument. Section H: Programs based on recursion: Question H1: WAP to calculate the GCD of two numbers using recursive function. Question G2: WAP to find out the factorial of two numbers using recursive function. Question H3: WAP to print Fibonacci series using recursive function. Question H4: WAP to sort an array using Quick sort technique (recursive). Question H5: WAP for the recursive Depth first search. Question H6: WAP for the recursive Breadth first search. Question H7: WAP to sort an array using recursive merge sort technique. Question H8: Write a recursive merge sort algorithm. Question H9: Write a recursive function to multiply two polynomials. Section I: Programs based on structures: Question I1: WAP to define a structure with the following specification Structure name Emp Ecode integer Ename character array

Basic salary Hra Da Ta Gross salary It Pf Net salary

float float float float float float float float

40% of basic salary 20% of basic salary 10% of basic salary basic salary + hra + da + ta 20 % of gross salary 10% of gross salary gross salary – (it + pf)

Now perform the following operations: (1) Take an object of the given structure, input the values for the ecode, ename, basic salary, calculate all other values and display the values. (2) Take an array of objects of size 10 of the given structure and input, calculate and display the values for 10 employees. Question I2: WAP to declare a structure with the following specification: Structure name abc Arr array of 10 floats Max float maximum of 10 values Min float minimum of 10 values Sum float sum of 10 values Avg float average of 10 values Take an object of structure type and input the values in arr and calculate all other values. Question I3: WAP to declare two structures with the following specification Structure name date Dd int day Mm int month Yy int year Structure name Rollno Name Marks Dob Doa student int char[10] float date date

date of birth date of admission in school

Now perform the following operations: • Take an object of structure student, input the values and display the values. • Take an array of objects of structure student of size 10 and input the values for 10 students and display the values. Question I4: Input 10 records in an array with the following structure: Sturct item

{ int itemcode, qty; char itemname[20]; }; Now perform the following operations: • Sort the array in the ascending order of itemcode using bubble sort technique and display the resultant array. • Sort the array in the descending order of itemcode using selection sort technique and display the resultant array. • Input an item code and search the given item code in the array and display all the details of the given item.(using linear search technique) • Input an item code and search the given item code in the array and display all the details of the given item.(using binary search technique) Question I5: Declare a structure with the following specification: Structure name line X int Y int Write a function having two arguments of structure type and returns a structure after addition of two objects. Question I6: Declare a structure with the following specification. Structure name String Char str[40] Write a function which receives two arguments of structure type and returns a structure after concatenating strings of both the objects. Section J: Programs based on classes, constructors & destructors and inheritance Question J1: WAP to input rollno, name and marks in five subjects and calculate the total and average marks through classes. Define different functions to input, calculate and display the data. Question J2: WAP to declare a class with the following specification Class name Emp (Data members) Private: Ecode integer Ename character array Basic salary float Hra float 40% of basic salary Da float 20% of basic salary Ta float 10% of basic salary Gross salary float basic salary + hra + da + ta It float 20 % of gross salary Pf float 10% of gross salary Net salary float gross salary – (it + pf) (Member functions) Public: void Input( ) - function to input the values for

void calc( ) void disp( )

ecode, ename and basic salary - function to calculate all other values - function to display the all the values.

Now perform the following operations: (1) Take an object of the given class, input, calculate and display values for one employee. (2) Take an array of objects of size 10 of the given class and input, calculate and display the values for 10 employees. Question J3: WAP to declare a class with the following specification class name taxpayer Data members(private) int pan char name[20] float income float tax Member functions input( ) to input the data disp( ) to display the data calctax( ) to calculate the tax. Tax is calculated according to the following rates: Income tax < = 100000 0% 100001 to 200000 10% 200001 to 500000 15% >500000 20% WAP to declare the object of above class, input the data, calculate the tax and display the data. Question J4: Declare a class student with the following specification Class name student Data members(private) int rollno -roll number char name[20]; - name float marks[5];- marks in 5 subjects float Total -total marks float Average -average marks float Grade - grade according to the average marks Member functions(public) void Input( ) - to input the data void Calcgrade( ) - to calculate total, average and grade void Dispdata( ) -to display the data. Grades are calculated according to the following rates: Average Grade >=75 A 60-74 B

40-59 C <40 fail Now perform the following operations: (1) Take an object of the given class, input, calculate and display values for one student. (2) Take an array of objects of size 10 of the given class and input, calculate and display the values for 10 students. Question J5: Declare a class student with the following specification Class name student Data members (private) int rollno -roll number char name[20]; - name char address[30] -address of the student char city[30]; -city of the student char country[30]; -country of the student Member functions(public) void Input( ) - to input the data int Retroll( ) -function to return the roll number of the student void Dispdata( ) -to display the data. Declare an array of objects of given class of size 10 and perform the following operations. • Sort the array in the ascending order of rollno and display the resultant array. • Input a roll number and search the given roll number in the array and display all the details. Question J6: Define a class string with the following specifications: class name string Data members (private) char n[20]; char m[20]; Member functions (public) string ( ) constructor to initialize both the strings void rev( ) to reverse both the strings void copy( ) to copy m to n void concat( ) to concatenate both the strings void count( ) to count the number of characters in both the strings WAP to declare an object of the above class and show the use of all the functions inside the class. Section K: Programs Based on function and constructor Overloading Question K1: Write a overloaded function to compute the simple interest. Question K2: Define a class with the following specification Class name xyz Data members (private) Principle float Time int Rate float

Total_amount float Member functions (public) xyz( ) constructor (overloaded constructor to initialize the data members) calc( ) to calculate total amount disp( ) to display all the values. Declare different objects of xyz class with different arguments, calculate the total amount for each object and display the values of all the objects. Section L:Programs based on Operator overloading Question L1: Overload unary minus(-) operator to make data members inside the structure / class negative. • Using structure • Using class (member functions) • Using class (friend function) Question L2: Overload “++” and “- -“ operator. • Using structure • Using classes (member functions) • Using classes (friend functions) Question L3: Overload ‘+’ operator to add two complex numbers. • Using structure • Using class (member function) • Using class (friend function) Question L4: Overload ‘+’ and ‘*’ operator to add and multiply two matrices. • Using structure • Using class (member function) • Using class (friend function) Question L5: Overload ‘+’ operator to concatenate two strings • Using structure • Using class (member function) • Using class (friend function) Question L6: Overload ‘>>’ and ‘<<’ operators. • Using structures • Using classes (friend function) • Using classes (friend function) Question L7: WAP to overload new and delete operators inside the class. Section M: Programs based on file handling: Question M1: WAP to read and write student records from a text file “Student.txt”. Question M2: WAP to read and write employee records from a binary file “emp.dat”. • using structures • using classes Question M3: WAP that opens a file “message.txt” and displays its contents. Question M4: WAP to copy the contents of the file “abc.dat” to “xyz.dat”.

Question M5: A binary file “stu.dat” contains student records. WAP to create a binary file “stusort.dat”, which contains all the records of “stu.dat” in the sorted order of roll number. Question M6: WAP to count the number of employee records in a binary file “emp.dat” whose department number is 10. • using structures • using classes Question M7: WAP to search a given employee record by employee number or name in a binary file using structures / classes. Question M8: There are 100 records present in a file with the following structure: Sturct item { int itemcode, qty; char itemname[20]; }; WAP to read these records and arrange them in ascending order of itemcode and write them in target file separately.. Question M9: WAP to modify a given employee record in a binary file using structures / classes. Question M10: WAP to delete a given employee record in a binary file using structures / classes. Question M11: WAP to count the number of characters, alphabets, vowels and consonants in a file “poem.txt”. Question M12: WAP to count the number of words and lines in a file “poem.txt”. Question M13: WAP to count the number of spaces, tabs and newline characters in a file “Notes.txt”. Question M14: Assume that a text file named TEXT1.TXT already contains some text written into it, write a program that reads file TEXT1.TXT and create a new file named TEXT2.TXT, which shall contain only those words from the file TEXT1.TXT which don’t start with an uppercase vowel ( i.e. with ‘A’, ‘E’, ‘I’ , ‘O’, ‘U’). Question M15: WAP which takes “story.txt” as input file and creates a new file “story1.txt” by replacing all the spaces with “-“, tabs by “%” and newlines by “$”. Question M16: WAP that merges two input files ”Data1” and “Data2” giving the third output file “Dataf”. The 2 input files contain records in ascending order of their roll numbers and resultant file should also be in ascending order. Write this program using • Without using structures / classes • structures • classes Question M17: A binary file “Employee.dat” containing Empno, Wrate( hourly wage rate), Noh (number of hours worked / week) fields. Write a C++ function to read each record, compute weekly wage as Wrate * Noh and display Empno, Wrate, Noh, Wrate*Noh. Question M18: WAP to check a C++ program for matching characters ({ }, ( ), /* */) and display whether they are well formed or not. Question M19: WAP to read a binary file “Emp.dat” using classes and display only those records whose salary is between 10000 and 20000 and job is “Manager” Question M20: WAP which reads one line at a time from the disk file “TRY.TXT” and display it on the monitor. The maximum length of the line is 80 characters. Question M21: WAP to write the contents of a string variable one character at a time to the disk file OUT.TXT.

Question M22: Write an interactive menu driven program to create a text file and then display the file. Create another text file by converting upper case letters to lower case letters and lower case letters to upper case letters of the newly created text file. Question M23: Write an interactive menu driven program to create a text file and then display the file. Create another text file by reversing each string of the newly created text file. Question M24: WAP that reads a text file and creates another text file that is identical except that every sequence of consecutive blank space is replaced by a single space. Question M25: WAP to read a text file and display it on the screen. In case number of lines exceeds 22, file should be displayed one screen at a time. Question M26: WAP to print a text file on the printer. Question M27: WAP that displays the size of file in bytes. Section N: Stacks and Queues (Implement all the questions using structures and classes both) Question N1: WAP to implement a static stack and show the push and pop operations on the stack. Question N2: WAP to implement a static queue and show the insert and delete operations on the queue. Question N3: WAP to implement a static circular Queue. Question N4: WAP to implement a static dequeue (using arrays). Question N5: WAP to implement n stacks in single 1D array. Write functions for “push” and “pop” operations on i-th stack. Question N6: WAP to implement n queues in single 1D array. Write functions for “add” and “delete” operations on i-th queue Question N7: Represent a stack and a queue in a single 1D array. Write functions for “push”, “pop” operations on stack and “add”, “delete” operations on the queue. Section O: Linked Lists (Implement all the questions using structures and classes both) Question O1: WAP to implement a single linked list of integers and perform the following operations • add an integer in beginning • add an integer after the given element in the list • add an integer before the given element in the list • add an integer at the position given by the user. • add an integer at end • display the list • delete an element from the beginning • delete an element from the end • delete an element from specified position. • delete an element given by the user. • Search an item in the list. Question O2: WAP to implement a circular linked list of integers Question O3: WAP to implement linked stack

Question O4: WAP to implement a linked queue. Question O5: WAP to implement a linked circular Queue. Question O6: WAP to implement a linked dequeue. Question O7: WAP to create two linked lists of integers in ascending order and merge both the lists to create a new list in ascending order. Question O8: WAP to reverse a linked list. Question O9: WAP to check that the given linked list of integers is sorted in ascending order or not. Question O10: WAP to split a linked list into two linked lists, so that each list gets equal number of nodes. (delete a node if required). Question O11: WAP to concatenate two linked lists. Question O12: WAP to convert a singly linked list into circular linked list. Question O13: WAP to create a single linked list of integers, where the new node has to be inserted in such a way that the list is always sorted in ascending order. Question O14: WAP to count the maximum, minimum, sum, average and count of the values stored in the linked list of integers. Question O15: X points to the first node of the singly linked list. Search the first occurrence of ITEM in the list and split the list into two, so that y points to the sublist beginning with ITEM. Question O16: Write a program that creates a linked list of characters from a string entered by the user. Your program is then to remove a number of consecutive elements from the linked list (in effect removing a sub-string from the string entered). This is to be achieved by the user entering two integers. The first of which will represent an index (counting from zero) into the linked list, and the second will represent the number of elements to be removed. For example, if the user enters the following string (without the quotes): "I do not love C" and then enters the two integers 2 and 7, the program would output (without the quotes): "I love C" Your program is to use only one linked list. Question Q17 : WAP to sort a linked list of integers using insertion sort technique. Question O18: WAP to implement a doubly linked list and implement the fllowing functions : • • • • • • • • • add a node in beginning add a node after the given element in the list add a node before the given element in the list add a node at the position given by the user. add a node at end display the list delete an element from the beginning delete an element from the end delete an element from specified position.

• •

delete an element given by the user. Search an item in the list.

Section P: Binary Trees (Implement all the questions using structures and classes both) QuestionP1: Create a binary search tree and perform • Preorder traversal(recursive and non recursive) • Inorder traversal(recursive and non recursive) • Postorder traversal(recursive and non recursive) Question P2: WAP to count the number of leaf nodes in a binary tree. Question P3: WAP to list the list the data fields of a binary tree level by level. Within levels, nodes are to be listed from left to right. Question P4: WAP to compute the height of a binary tree. Question P5: WAP to check that two binary trees are similar. Question P6: Construct two binary trees so that their preorder traversal sequences are the same. Question P7: Construct two binary trees so that their postorder traversal sequences are the same. Question P8: Write a function to swap a binary tree. Question P9: Write a function to compute the maximum number of nodes in any level of a binary tree. The maximum number of nodes in any level of a binary tree is also called the width of the tree Question P10: Write a function to find out the inorder successor of a given node in a binary tree. The inputs to the function are a pointer to the root of the tree and a pointer to a node. The function returns a pointer to the inorder successor of the given node. Question P11: Write a function to find out the inorder predecessor of a given node in a binary tree. The inputs to the function are a pointer to the root of the tree and a pointer to a node. The function returns a pointer to the inorder predecessor of the given node. Question P12: Write a function to compute the internal path length of a binary tree. Question P13: Write a function to compute the external path length of a binary tree. Question P14:Write a function to delete a node from a binary search tree which ultimately deletes the inorder predecessor of the node to be deleted if the node has exactly two non empty children. Question P15: Write a function to check whether a given binary search tree is an AVL tree or not. Question P16: Write a non recursive function to insert a node in AVL tree. Question P17: Write a non recursive function to delete a node from an AVL tree. Question P18: Write a recursive function to delete a node from an AVL tree. Question P19: Write a function to merge the nodes of two AVL trees to obtain a new AVL tree. Question P20: Write functions to find the immediate predecessor and immediate successor of a given key value in a B-tree. Question P21: Write a function to insert a new key to a B-tree of order “m”. Question P22: Write a function to delete an existing key from a B-tree of order “m”. Section N: Command Line Arguments Bitwise Operators

Question: WAP to divide an unsigned number by another number using bitwise operators.

Question: WAP for Hanoi problem.