Documente Academic
Documente Profesional
Documente Cultură
Page 2 of 8
b) Which conditional construct is used for checking more than two related conditions?
c) Write a valid loop syntax for seven iterations?
d) Where the task that the function executes is defined?
e) Which indicates the type of value returned by the corresponding function?
f) The value passed to the function at the time of calling are known as ?
g) The function from where the other function is called is known as?
h)The variable used in the functions definition are known as ?
4.CORRECT THE UNDERLINE ERRORS:-
a) == is an assignment operator.
b) if-else is used to check more than two related conditions.
c) An array can store any number of elements irrespective of the array size.
d) array Size must be a character constant greater than zero.
e) Valid loop syntax for ten iterations- for(int i=0; i<7; i++).
f) Variables in the function definition are called arguments.
g) Syntax used to declare an array is:- type arrayName[variableSize]
5.ANSWER THE FOLLOWING QUESTIONS:-
a) What is Function?
b) What is User Defined Function?
c) Write the Syntax of User Define the Function.
d) What is Return Type?
e)What is Function name?
f) What is Parameters?
g) Define Function Call.
h) What is Built in or Library functions.
i) Explain the concept of Array with example, write the syntax to define an array.
j) In an array, if the value of the number of elements is n then what will be the range of Index values.
Page 4 of 8
d) A is a collection of pre-defined function.
2. STATE TRUE OR FALSE:-
a) <maths.h> is a c++ library function.
b) ceil is used to calculate the round down value of a floating number.
c) Both, the ceil( ) and floor( ) library functions, give the same output.
d) abs( ) is used to calculate the relative value of an integer.
3. ONE WORD ANSWER:-
a) Why do we use pow() function?
b) What is the output of the function sqrt(25)?
c) What is the output of the function pow(2,3)?
d) What is defined within the <ctype.h>library ?
4. CORRECT THE UNDERLINE ERRORS:-
a) ciel() is a library function.
b) sqr ( ) library function is used to calculate the square root of a number.
c) The output of the function abs(-7) is 8.
d) isuper library function checks if the entered character is in case or not.
5. ANSWER THE FOLLOWING QUESTIONS:-
a) Define Library and Library Function.
b) Why do we need to include Library Functions in the beginning of the program.
c) Define the following library functions-
I. ceil( )
II. floor( )
III. pow( )
IV. abs( )
V. sqrt( )
d) Discuss the use of <math.h>&<ctype.h> Library.
e) Define the following character Library Functions-
I. isupper()
II. islower( ).
f) Differentiate between ceil( ) and floor( ) Library functions.
g) Differentiate between sqrt( ) and pow( ) Library functions.
CORRECT THE ERRORS FROM THE FOLLOWING PROGRAMME:-
1) #include<stdio.h>
#include<conio.h>
#include<max.h>
void main();
{
double n=400, result;
res=sqrts(n);
cout<<"Thr Square Root of "<<n<<" is:"<<result<<endl;
getch();
)
1) #include<iostream.h>
#include<stdio.h>
#include<ctype.h>
void main[ ]
{
floaute n=9.9, res;
result=ceile(9.9);
Cout<<”Round Up value of 9.9 is-“<<result;
getch()
};
Page 5 of 8
2) #include<ctype.h>
#include<conio.h>
#include<math.h>
void main();
{
int base=2,exponent=6, result;
result=power(base,expect);
cout<<”Value of 2^6 is:”<<res<<endl;
getch()
};
3) #include<ctype.h>
#include<stdio.h>
#include<math.h>
void main()
{
int n=-25, result;
result=absolute(a);
cout<<”Absolute value of -25 is-“<<results;
getch()
};
for(i=0;i<5;i++)
{
a[i]=a[i]-2+7;
}
for(i=4;i>=0;i--)
{
cout<<”out put:”<<a[i]<<endl;
}
getch();
}
2) #include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[5]={5,10,15,20,25};
int i;
for(i=0;i<5;i++)
{
a[i]=(a[i]*2)/5;
Page 6 of 8
}
for(i=4;i>=0;i--)
{
cout<<”out put:”<<a[i]<<endl;
}
getch();
}
3) #include<iostream.h>
#include<conio.h>
classtr
{
public:
int bb;
inthh;
tr(intb,int h)
{
bb=b;
hh=h;
}
voidar()
{
float a;
a=1/2*(b*h);
cout<<"Area="<<a<<endl;
}
};
void main()
{
clrscr();
trob(10,15);
ob.ar();
getch();
}
4) #include<iostream.h>
#include<conio.h>
class ci
{
public:
int ra;
ci(int r)
{
ra=r;
}
voidar()
{
float a;
a=(3.14)*(r*r);
cout<<"Area="<<a<<endl;
}
};
void main()
Page 7 of 8
{
clrscr();
ciob(10);
ob.ar();
getch();
}
2. a) Write a program in C++ by using the concept of Class and Object define a class
Simple_Interest with following specifications:-
Private Members:
a. Principal Amount
b. Rate of Interest
c. Time Period.
d. A function calculate() to be declared to calculate simple interest.
Public Members:-
a. A function accept() to be declared to accept information.
b. A function display() to be declared to show contents prepared by the user.
b) Create an object of Simple_Interest and calculate SI for the Principal Amount entered by the user.
};
class Course: public Student, private Faculty
{
int CCode;
char CName[20];
char StartDt[8],EndDt[8];
public:
Course();
void Commerce();
void CDetail();
};
i. Which type of inheritance is illustrated in the above C++ code?
ii. Write the names of all the data members, which is/are accessible from member function
accept() of class Student.
iii. Write the names of all the data members, which is/are accessible from member function Show()
of class Faculty.
iv. Write the names of all the data members, which is/are accessible from member function
Commerce() of class Course.
v. Write the member functions, which are accessible from objects of class Student.
vi. Write the member functions, which are accessible from objects of class Faculty.
vii. Write the member functions, which are accessible from objects of class Course.
viii. Mention visibility mode of Student class when inherited by Course class.
ix. Mention visibility mode of Faculty class when inherited by Course class.
x. Member function Course() function has no return type. Why?
SYLLABUS:-
Chapters Name
1. Chapter 7 : NEW TRENDS ON THE INTERNET.
2. Chapter 8 : PROGRAMMING WITH C++.
3. Chapter 9 : BEGINNING WITH OOPS & CONCEPTS OF CONSTRUCTOR.
4. Chapter 10 : INHERITANCE & FUNCTION OVERLOADING.
5. Chapter 11 : USING THE C++ LIBRARY.
---------------------------------------------***************------------------------------------------------
Page 9 of 8