You are on page 1of 4

Q-we take two integers, add them and display the answer on the screen.

Q-calculates the average age of a class of ten students after prompting the user to enter the age of each student. Q-Write a program that takes a four digits integer from user and shows the digits on the screen separately i.e. if user Enters 7531, it displays 1,3,5,7 separately. Q-Write a program that takes radius of a circle from the user and calculates the diameter, circumference and area of the circle and display the result. Q-There are two students Ameer and Amara. We take their ages from the user, compare them and tell who is older? Q-A shopkeeper announces a package for customers that he will give 10 % discount on all bills and if a bill amount is greater than 5000 then a discount of 15 %. Write a program which takes amount of the bill from user and calculates the payable amount by applying the above discount criteria and display it on the screen. Q-Calculate the sum of even numbers for a given upper limit of integers. Q-Calculate the factorial of a given number. Q-Calculate the sum of odd integers for a given upper limit. Also draw flow chart of the program. Q- Calculate the sum of even and odd integers separately for a given upper limit using only one loop structure. Also draw flow chart of the program. Q-Create a program that allows the user to guess a character from a to z in five attempt.{ //do-while construct is used to allow five tries for guessing} Q-Create a program that takes an integer input from user and displays its table. Q-Create a program that displays the sum of squares of integers from 1 to n . Q-Create a program that displays the description of a grade using switch statement.{ program gets a grade from user and displays a description accordingly } Q- Lets consider a problem. In a company, there are deductions from the salary of the employees for a fund. The deductions rules are as follows: i) If salary is less than 10,000 then no deduction ii) If salary is more than 10,000 and less than 20,000 then deduct Rs. 1,000 as fund iii) If salary is equal to or more than 20,000 then deduct 7 % of the salary for fund Take salary input from user and after appropriate deduction show the net payable amount. Q-Write a program to enter the numbers till the user wants and at the end it should display the count of positive, negative and zeros entered Q-Write a program to find the range of a set of numbers. Range is the difference between the smallest and biggest number in the list Q-Write a program which Prints the following pattern up to 10 lines 0 111 22222 3333333

Q-Write a program to produce the following output: ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A Q-Write a program which takes three sides a, b and c of a triangle input and calculates its area if these conditions are satisfied a+b>c, b+c>a, a+c>b (Help a= vs(s-a)(s-b)(s-c), where s=(a+b+c)/2 Q-Write a program that inputs an integer determine if it is even or odd. Q-Write a program which takes a character input and checks whether it is vowel or consonant. Q-According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year 1st is input through the keyboard write a program to find out what is the day on 1of this year. Q-Write a program which takes a text input counts total number of vowels, consonants and other special characters and prints the result Q-Write a program to make a simple calculator which should be able to do +,-,*,/,% Operations Q-Write a program which takes 10 integers as input and prints the largest one. Q-Write a program to find a. Surface area (A=4pr 2 ) b. volume(v=4/3 p 3 ) of a sphere using functions make a function for finding powers of radius. Q-Write a function to compute the distance between two points and use it to develop another function that will compute the area of the triangle whose vertices are A(x1, y1), B(x2, y2), and C(x3, y3). Use these functions to develop a function which returns a value 1 if the point (x, y) lines inside the triangle ABC, otherwise a value 0. Q-Write a program using functions to evaluate up to 8 terms sin(x)= x - x 3 + x5 - x7 + x9 - . 3! 5! 7! 9! Q-Write a program that takes input for array int a[5] and array int b[5] and exchanges their values. Q-Write a program that takes 10 integers as input and prints the largest integer and its location in the array. Q-Write a program to copy the contents of one array into another in the reverse order. Q-Write a program which takes a string as input and counts total number of vowels in that. Q-Write a program to sort an integer array in descending order. Q-Write a program that adds up two 4x4 arrays and stores the sum in third array. Q-Write a program which takes names of five countries as input and prints them in alphabetical order. Q-A 6 x 6 matrix is entered through the keyboard and stored in a 2-dimensional array mat[7][7]. Write a program to obtain the Determinant values of this matrix ..

Q3. Define a class Complex_No that has two member variables; Real and Imaginary. Also include following in the class structor that assign zero to Real and Imaginary.

plex numbers and return result; take one complex number as argument. Write a driver program to test your class Q4. Define a class Counter having an attribute value. Provide a constructor that initializes value to zero. Also provide following methods: Increment () : that increment the value by one.

Q5. Define a function Reset that takes a Counter type object as input and resets its value to zero. Make this function a friend of Counter class Q6. Define a class Student that has following attributes: Name: allocated dynamically by a character pointer. Rollno: an integer. Marks: a double type array of 5 elements. Percentage: a float Include a constructor that takes values of Name, Rollno and Marks from user as input. Also include following methods: CalculatePercentage: that adds all 5 elements of array Marks and calculate percentage according to formula Percentage = (Total marks/ 500 )*100 and stores result in member variable Percentage. Grade: that calls CalculatePercentage method and displays the grade accordingly Write a driver program to test your class. Q1. Write a program that takes the record of 10 students from user in an array and display all the records.[use Student class, defined in lab session 02] Q2.Define a pointer to student class to access the contents of array defined in Q1. Allow user to search a record in array by means of Rollno Q3. Develop a class to represent an integer array. The member variables include an integer to represent the size of array and an integer pointer to represent the address of the first element of the array. The user is allowed to create an array at runtime using this class. Include appropriate constructors (parameterized and copy). Also include a method that adds the contents of array. . Q3. Extend the Student class( defined in lab session 02) to represent science and arts student. Science student has additional practical course of 150 marks while arts student has an optional course of 100 marks. In each class redefine CalculatePercentage method Science student: Percentage =Total marks/650*100 Art student: Percentage=Total marks/600*100 Include constructor and display method in each class. Write a driver program to test your classes. Q4. Develop a class Post that has following attributes Name: a string To : a string that holds the reciever's address StampCost: a float that holds the value of postal stamp required The class should include following:

's values on screen Develop another class RegisteredPost that inherits from Post class and has following additional attributes: Weight: a float that holds the weight of post

ReistrationCost: a float that holds registration charges Also include following in the class.

ues on screen Q5. Develop a class InsuredRgisteredPost that inherits from RegisteredPost class and has additional attribute AmtInsured to hold the insured value of post. The class should include following:

AmtInsured. .. Q1. Overload +, - ,* , / ,++ , - - (both postfix and prefix), >, < , == operators for the class Complex_No.(you have defined in lab session 02). Comparison should be done on the basis of magnitude. Write a driver program to test your class. Q2. Define a class Matrix to represent 2x2 matrix. Overload operators for addition and subtraction of two matrices using friend function. Write a driver program to test your class. Q3. Overload [ ] , insertion (<<) and extraction(>>) operators for class vector that represents 2D vector. Write a driver program to test your class