Friday, 7 November 2014

Write a C++ Program illustrating to sort integer numbers.

#include <iostream.h>
void main(void)
{
int t,i,j;

int n;

cout<<"Enter the number of values to be sorted ";

cin>>n;

int s[20];

cout<<"\nEnter  values ";

for(i=0;i<n;i++)

cin>>s[i];

cout<<endl;

cout<<"sorted list is ";

for(i=0;i<n;i++)

{

for(j=0;j<n-i;j++)

{

if (s[j]>s[j+1])

{

t=s[j+1];

s[j+1]=s[j];

s[j]=t;

}

}

cout<<endl;

cout<<"Pass "<<i+1<<" ";

for(int k=0;k<n;k++)

cout<<s[k]<<" ";

}

cout<<endl;

}

Write a C++ program illustrating interactive program for computing the roots of a quadratic equation by handing all possible cases use streams to perform I/O operations

#include<iostream.h>
#include<math.h>
int main()
{
float a,b,c,d,root1,root2;
cout<<"Enter value of a, b and c : ";
cin>>a>>b>>c;
d=b*b-4*a*c;
if(d==0)
{
root1=(-b)/(2*a);
root2=root1;
cout<<"Roots are real & equal";
}
else if(d>0)
{
root1=-(b+sqrt(d))/(2*a);
root2=-(b-sqrt(d))/(2*a);
cout<<"Roots are real & distinct";
}
else
{
root1=(-b)/(2*a);
root2=sqrt(-d)/(2*a);
cout<<"Roots are imaginary";
}
cout<<"\nRoot 1= "<<root1<<"\nRoot 2= "<<root2;
getch();
return 0;
}

Friday, 10 October 2014

OOP IMP QUESTIONS



  1.    Explain the Key concepts of Object Oriented Programming?
  2.    Difference between c and c++, disadvantages of conventional programming, programming paradigms.
  3.    a) Explain Memory Management Operators?
  b)  Explain user defined data types? 
4.   a) Explain parts of a function?
 b) Explain the following?
i) Call by values ii) Call by reference..   

Thursday, 9 October 2014

#include<iostream.h>
#include<conio.h>
int main()
{
     unsigned long int fact(int);
     unsigned long int f;
     int x;
     cout<<"Enter a Number: ";
     cin>>x;
     f=fact(x);
     cout<<"Factorial of  "<<x<<"  is  "<<f;
     return 0;
}
unsigned long int fact(int a)
{
    unsigned long int factorial;
    if(a==1)
              return 1;
   else
              factorial=a*fact(a-1);
   return factorial;
}


Saturday, 20 September 2014

Write a C++ program illustrating Swapping integer values by reference.

#include<iostream.h>
#include<conio.h>
void swap (int &a, int &b)
{
/* &a and &b are reference variables */
int temp;
temp=a;
a=b;
b=temp;
}
main()
{
clrscr();
int i=5,j=10;
cout<<"Before swapping I = "<<i<<" J = "<<j<<endl;
swap(i,j);
cout<<"After swapping I = "<<i<<" J = "<<j<<endl;
}

Write a C++ program illustrating Variable Scope

Write a C++ program illustrating Variable Scope
A scope is a region of the program and broadly speaking there are three places, where variables can be declared:
·         Inside a function or a block which is called local variables,
·         In the definition of function parameters which is called formal parameters.
·         Outside of all functions which is called global variables.
Local Variables:
Variables that are declared inside a function or block are local variables. They can be used only by statements that are inside that function or block of code. Local variables are not known to functions outside their own. Following is the example using local variables:
#include <iostream>

int main ()
{
  // Local variable declaration:
  int a, b;
  int c;

  // actual initialization
  a = 10;
  b = 20;
  c = a + b;

  cout << c;

  return 0;
}

Global Variables:

Global variables are defined outside of all the functions, usually on top of the program. The global variables will hold their value throughout the life-time of your program.
A global variable can be accessed by any function. That is, a global variable is available for use throughout your entire program after its declaration. Following is the example using global and local variables:
#include <iostream>
// Global variable declaration:
int g;
 int main ()
{
  // Local variable declaration:
  int a, b;
 
  // actual initialization
  a = 10;
  b = 20;
  g = a + b;
 
  cout << g;
 
  return 0;
}
A program can have same name for local and global variables but value of local variable inside a function will take preference. For example:
#include <iostream>
// Global variable declaration:
int g = 20;
 int main ()
{
  // Local variable declaration:
  int g = 10;

  cout << g;

  return 0;
}


Friday, 25 July 2014

Software Engineering IMP QUESTIONS

1. Explain about Object Oriented Design Process in detail? (refer Somerville text book)
2. What is White Box Testing? Explain White Box Testing Techniques?
3. Explain about Risk Projection?
4. What are the different metrics for software quality? (Page No. 661)
5. Explain about Formal Technical Reviews?