Beruflich Dokumente
Kultur Dokumente
Instructions to Candidates:
All questions carry equal marks. This assignment will be a closed book one.
No formula sheet will be provided however students shall use scientific
calculators.
Only one full question to be answered by a student as assigned by the faculty
1 a) With neat block diagram of a computer explain the functions of CPU detailing its (2M)
functional units?
1 b) Write an algorithm to check whether the given year is a leap year or not? (2M)
1 c) Write a complete C++ program to generate the following output pattern (2M)
1
3*2
4*5*6
10*9*8*7
11*12*13*14*15
2 a) What is system software? Brief about the different categories of computer (2M)
languages?
2 b) Write an algorithm to check whether the given positive integer number is a perfect (2M)
number or not?
if(a>b)
if(a>c)
cout<<” a”;
else
cout<<”c”;
else
if(b>c)
cout<<”b”;
else
cout<<”c”;
3 c) Write a complete C++ program to read a number and check for the following (2M)
operations using a while Loop.
4 a) What is a variable? Give the rules for valid variable names? (2M)
4 b) What is operator precedence and associativity? Resolve the expression stepwise to (2M)
obtain the final value of x. int x=(-10*(2-3)/15%(5+7)+8*6/12);
int main(){
int i=2, n, j;
{ if (j%2 != 0)
continue;
cout<<i<<"*"<<j<<"="<<i*j<<endl;
if (i % 3 == 0)
break;
}
5 a) Explain the use of typecast operator with a suitable example? (2M)
5 b) Convert the following switch structure to its equivalent if - else if - else structure. (2M)
switch(ch)
{
case 1: cout<<”one”; break;
case 2: cout<<”two”; break;
case 3: cout<<”three”; break;
case 4: cout<<”four”; break;
case 5: cout<<”five”; break;
default : cout<<” one to five”;
}
x=a + b/3+c*2-6;
y=a + b/(3+c)*(2-5);
z=a-(b/(3*c)*2)-4;
zz=(x + y )/z+2;
6 c) Write complete C++ program using both i) nested if and (ii) else if ladder control (2M)
structures to calculate the commission for the input value of sales.
1. Commission is NIL for sales amount <= 5000 for females and for males
commission is 2% for sales amount <=5000.
2. Commission is 2% of sales when sales amount is more than Rs. 5000 for
females and for males it is 4%.
3. Commission is 6% for sales amount > Rs. 10,000 for both males and
females.