cs201 Q
cs201 Q
7. Read the given below code and explain what task is being performed by this function
numRows = row ;
numCols = col ;
elements [ i ] [ j ] = 0.0 ;
10. write a progarm that take 2 variable from user in main and display the its dec ,hex,oct form.
11. write a program using octal function that takes a decimal number and then convert it in to octal
12. write a program that takes score of different classes and calculate avgr of each class , every class
havmaxiumum 250 students, expln which arry is suitabel .
13. function k progrmaski coding thi , write the given situation .set krnatha program ko .
14. can we write intfunc(intx,int y) intfunc (int&x,int&y) these two functions in a same program ,, if
your answer is no expln it ???
15. past ppr m say akprgramtha half diatha half kud complete krnatha ..akfuction m class di hoi hai
date , address , name lekhy , ak given funtionthajis m date di hoi thi ,day ,month or year ...
1. Write a program which defines five variables which store the salaries of five employees, using
setw and setfill manipulators to display all these salaries in a column.
2. Write a C++ program that contains a class ‘myClass’ having two data members of type int.
3. Write down piece of code that will declare a matrix of 3x3. And initialize all its
9. How can we initialize data members of contained object at construction time? 3 marks
10. how many arguments take by non meber and member function of binary operator? 3 marks
11. The following code segment has errors. Locate as many as you can and explain briefly.
class Circle:
{
private :
double centerX;
double centerY;
double radius;
public:
setCenter(double, double);
setRadius(int);
}? 5 marks
14. Write program to copy one array into another array and array of 5 elements
17. Write a program for array of 10 numbers using float data type and initialize
the first 4 numbers at 1.0,2.0,3.0,4.0
18. We use Malloc or Calloc to allocate memory chuck, what should we check
against to know if the allocation of the memory chunk was successful or not.
19. Why do we use delete to free memory? write the code to free memory in the
following code (Code consisted new operator but no delete operator to free it
just had to enter that in the code)
21. Find mistakes in the given code, give reason for the mistakes and also write
the correct code. (the program was about Teacher ID and coding consisted of
class and constructor)
22. Suppose we want to write a Macro that swaps 2 numbers, what problems can
we come across and how do we avoid them? Give 5 affects
28. Use three variable to expose the dec, hex, and oct.
29. Write c++ programs with three variable salary, no. Of days and rate
and salary account by the formula Salary= no.days*rate. Take out of
no of days with the daily rate of 1000 per day.
30. write c++ program with 2 variable