0% found this document useful (0 votes)
5 views

cs201 Q

The document contains a series of programming questions and tasks related to C++ concepts, including macros, classes, memory management, and various programming constructs. It covers topics such as constructors, destructors, manipulators, and dynamic memory allocation, along with specific programming challenges like matrix manipulation and data type conversions. Additionally, it addresses differences between programming concepts, error identification in code, and the use of operators.

Uploaded by

kiran malik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

cs201 Q

The document contains a series of programming questions and tasks related to C++ concepts, including macros, classes, memory management, and various programming constructs. It covers topics such as constructors, destructors, manipulators, and dynamic memory allocation, along with specific programming challenges like matrix manipulation and data type conversions. Additionally, it addresses differences between programming concepts, error identification in code, and the use of operators.

Uploaded by

kiran malik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. precautions of using Macros (5)?

2. Call a nested class function in a main()?

3. Program to print matrix 2x4 ?

4. Diff b/w Reference and Memory address variable?

5. Write program on manipulators?

6. Constructor and destructor sequence of call.

7. Read the given below code and explain what task is being performed by this function

Matrix :: Matrix ( int row , int col )

numRows = row ;

numCols = col ;

elements = new ( double * ) [ numRows ] ;

for ( int i = 0 ; i <numRows ; i ++ )

elements [ i ] = new double [ numCols ] ;

for ( int j = 0 ; j <numCols ; j ++ )

elements [ i ] [ j ] = 0.0 ;

8. malloc function lagnithiprogarm ma

9. nested class wala program tha...

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.

Output should be displayed as given below:


xxxxxx1000
xxxxxx1500
xxxxx20000
xxxxx30000
xxxxx60000

2. Write a C++ program that contains a class ‘myClass’ having two data members of type int.

.Prompt the user to enter the number of objects to be created.


.Dynamically allocate memory to objects according to the size entered by user.
.De-allocate memory that was allocated to objects

3. Write down piece of code that will declare a matrix of 3x3. And initialize all its

locations with 0 using loop.

4. get(),Getline(),Put(),Putline() are input or output stream?

5. What is difference between endl and \n?

6. default visibility of inner and outer variables? 3 marks

7. what is casting? 3 marks

8. what is the source and destination of cin? 3 marks

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

12. Match the following correctly? 5marks

Operating system global positioning system

system software vista


application software disk compression

utility software interpreter

13. Program for class

14. Write program to copy one array into another array and array of 5 elements

15. Calloc and malloc function

16. Write program for constructor

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)

20. Suppose an object in Class A is made an object of Class B


For which class the constructor is called for first
For which class the destructor is called for first

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

23. Union ki output.

24. Matrix class ki output.

25. Pointers ki output .

26. Programs related to Templates, Dynamic memory allocation, classes,


Objects,Functions,Arrays.

27. Difference between default and parameterized constructors.

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

 Calculate rows and columns


 Calculate transpose of matrix
31. Function of default function
32. If you agree prototype of ordinary function and special function of a
class are same. Justify with comment.
33. Bitwise operator. What will be result If both operators are equal or both
are not.
34. Is it possible to overload new and delete operator. If yes in which scope
it will be declared?
35. Is it possible to overload primitive data types?
36. Syntax of Program.
37. Write code for overloading + operator
38. Write output and convert to if else
39. Program to find Even numbers
40. Program to convert decimal number to octal using user defined octal
manipulator
41. Default function arguments with example.
42. What is memory leak. How can be harmful for a system?
43. We have a class A,and we want to do same dynamic memory
allocation in it. What rules should be followed?
44. Is it possible using overloading change the behavior of_ (minus
operator) on integer?
45. Write a syntax in two different ways to initialize the character array
with string program?
46. convert if statement 'S Code into switch statement form.
47. define Compress of file.
48. new operator and it's function.
49. write a program by using macro .
50. define default function argument?
51. Explain and getline() syntax
52. Write a code for sum of first 10 integers
53. Difference between reference and pointer
54. A statement i s given for coding we decide to select static or
dynamically to write code
55. Write output for two codings
56. Find an error in code of classes and objects
57. Define unary operater also pre and post isi.. ka 1 long th pre or post
declare krna thy.
58. Manipulater
59. Constructor
60. parametrized manipulate
61. friend function
62. member function

You might also like