Monday, June 17, 2013

Forecasting

The second technique managers can use to assess the environment
is forecasting. Forecasting is an important part of
planning and managers need forecasts that will allow them
to predict future events effectively and in a timely manner.
Environmental scanning establishes the basis for forecasts,
which are predictions of outcomes. Virtually any component
in an organization’s environment can be forecasted. Let’s
look at how managers forecast and the effectiveness of those
forecasts.

Management Skills

Managing human capital
• Inspiring commitment
• Managing change
• Structuring work and getting things done
• Facilitating the psychological and social contexts of work
• Using purposeful networking
• Managing decision-making processes
• Managing strategy and innovation
• Managing logistics and technology

Mintzberg’s Managerial Roles and a Contemporary Model of Managing


Interpersonal Roles
• Figurehead
• Leader
• Liaison
Informational Roles
• Monitor
• Disseminator
• Spokesperson
Decisional Roles
• Entrepreneur
• Disturbance handler
• Resource allocator
• Negotiator

Who Is a Manager?


It used to be fairly simple to define who managers were: They were the organizational members
who told others what to do and how to do it. It was easy to differentiate managers from
nonmanagerial employees. Now, it isn’t quite that simple. In many organizations, the changing
nature of work has blurred the distinction between managers and nonmanagerial
employees. Many traditional nonmanagerial jobs now include managerial activities.9 For example,
at General Cable Corporation’s facility in Moose Jaw, Saskatchewan, Canada, managerial
responsibilities are shared by managers and team members. Most of the employees
at Moose Jaw are cross-trained and multi-skilled. Within a single shift, an employee can be
a team leader, equipment operator, maintenance technician, quality inspector, or improvement
planner.10
So, how do we define who managers are? A manager is someone who coordinates
and oversees the work of other people so that organizational goals can be accomplished. A
manager’s job is not about personal achievement—it’s about helping others do their work.
That may mean coordinating the work of a departmental group, or it might mean supervising
a single person. It could involve coordinating the work activities of a team with people
from different departments or even people outside the organization, such as temporary
employees or individuals who work for the organization’s suppliers

Tuesday, March 5, 2013

C++ Mcq Ch2 Variables


1.  Dividing a program into functions
a.  is the key to Object-Oriented Programming.
b.  makes the program easier to conceptualize.
c.  may reduce the size of the program.
d.  makes the program run faster.
2.  A function name must be followed by ________.
3.  A function body is delimited by ________.
4.  Why is the main() function special?

5.  A  C++ instruction that tells the computer to do something is called a ________.

6.  Write an example of a normal C++ comment and an example of an old-fashioned /*

comment.

7.  An expression

a.  usually evaluates to a numerical value.

b.  indicates the emotional state of the program.

c.  always occurs outside a function.

d.  may be part of a statement.

8.  Specify how many bytes are occupied by the following data types in a 32-bit system:

a.  Type  int

b.  Type  long  double

c.  Type  float

d.  Type  long

9.  True or false: A variable of type char can hold the value 301.

10.  What kind of program elements are the following?

a.  12

b.    'a'

c.  4.28915

d.    JungleJim

e.    JungleJim()

11.  Write statements that display on the screen

a.  the character 'x'.

b.  the  name Jim.

c.  the number 509.

12.  True or false: In an assignment statement, the value on the left of the equal sign is

always equal to the value on the right.

13.  Write a statement that displays the variable george in a field 10 characters wide.
14.  What header file must you  #include with your source file to use  cout and cin?

15.  Write a statement that gets a numerical value from the keyboard and places it in the

variable  temp.

16.  What header file must you perform #include with your program to use  setw?

17.  Two exceptions to the rule that the compiler ignores whitespace are ________ and

________.

18.  True or false: It's perfectly all right to use variables of different data types in the same

arithmetic expression.

19.  The expression 11%3 evaluates to ________.

20.  An arithmetic assignment operator combines the effect of what two operators?

21.  Write a statement that uses an arithmetic assignment operator to increase the value of the

variable  temp by 23. Write the same statement without the arithmetic assignment operator.

22.  The increment operator increases the value of a variable by how much?

23.  Assuming  var1 starts with the value 20, what will the following code fragment print out?

 

cout << var1--;

cout << ++var1;

 

24.  In the examples we've seen so far, header files have been used for what purpose?

25.  The actual code for library functions is contained in a ________ file.



Answers to Questions

1. b, c
2. parentheses
3. braces { }
4. It's the first function executed when the program starts
5. statement
6.

// this is a comment
/* this is a comment */

7. a, d
8. a. 4
b. 10
c. 4
d. 4
9. False
10. a. integer constant
b. character constant
c. floating-point constant
d. variable name or identifier
e. function name
11. a. cout << 'x';
b. cout << "Jim";
c. cout << 509;
12. False; they're not equal until the statement is executed.
13. cout << setw(10) << george;
14. IOSTREAM
15. cin >> temp;
16. IOMANIP
17. string constants, preprocessor directives
18. true
19. 2
20. assignment (=) and arithmetic (like + and *)
21.

temp += 23;
temp = temp + 23;

22. 1
23. 2020
24. to provide declarations and other data for library functions, overloaded operators, and
objects
25. library

C++ Mcq Ch1

1.  Pascal, BASIC, and C are p___ languages, while C++ is an o ____.language.

2.  A widget is to the blueprint for a widget as an object is to

a.  a member function.

b.  a  class.

c.  an  operator.

d.  a data item.

3.  The two major components of an object are ___ and functions that _____.

4.  In  C++, a function contained within a class is called

a.  a member function.

b.  an  operator.

c.  a class function.

d.  a  method.

5.  Protecting data from access by unauthorized functions is called ____.

6.  Which of the following are good reasons to use an object-oriented language?

a.  You can define your own data types.

b.  Program statements are simpler than in procedural languages.

c.  An OO program can be taught to correct its own errors.

d.  It's easier to conceptualize an OO program.

7.  _____ model entities in the real world more closely than do functions.

8.  True or false: A C++ program is similar to a C program except for the details of coding.

9.  Bundling data and functions together is called ____.

10.  When a language has the capability to produce new data types, it is said to be

a.  reprehensible.

b.  encapsulated.

c.  overloaded.

d.  extensible.

11.  True or false: You can easily tell, from any two lines of code, whether a program is

written in C or C++.

12.  The ability of a function or operator to act in different ways on different data types is

called __________.

13.  A normal C++ operator that acts in special ways on newly defined data types is said to be

a.  glorified.

b.  encapsulated.

c.  classified.

d.  overloaded.

14.  Memorizing the new terms used in C++ is

a.  critically  important.
b.  something you can return to later.

c.  the key to wealth and success.

d.  completely  irrelevant.

Answers to Questions

 

1. procedural, object-oriented               2.  b               3. data, act on that data               4.  a

5. data hiding                                      6. a, d            7.  objects

8. False; the organizational principles are different.       9. encapsulation

10.  d                                                 11. False; most lines of code are the same in C and C++.

12.  polymorphism                               13.  d               14.  b

Sunday, March 3, 2013

C++ Codes Of Classes And Objects 2



Define a class batsman with the following specifications:
Private members:
bcode                            4 digits code number
bname                           20 characters
innings, notout, runs        integer type
batavg                           it is calculated according to the formula – 
                                     batavg =runs/(innings-notout)
calcavg()                        Function to compute batavg
Public members:
readdata()                      Function to accept value from bcode, name, innings, notout and invoke the function                                       calcavg()
displaydata()                   Function to display the data members on the screen.



#include<iostream.h>
#include<conio.h>
#include<stdio.h>

class batsman
{
 int bcode;
 char bname[20];
 int innings,notout,runs;
 int batavg;
 void calcavg()
 {
  batavg=runs/(innings-notout);
 }

public :
 void readdata ();
 void displaydata();
};

void batsman::readdata ()
{
 cout<<"Enter batsman code ";
 cin>> bcode;
 cout<<"Enter batsman name ";
 gets(bname);
 cout<<"enter innings,notout and runs ";
 cin>>innings>>notout>>runs;
 calcavg();
}

void batsman::displaydata()
{
 cout<<"Batsman code "<<bcode<<"\nBatsman name "<<bname<<"\nInnings "<<innings
 <<"\nNot out "<<notout<<"\nRuns "<<runs<<"\nBatting Average "<<batavg;
}

int main()
{
 batsman obj;
 obj.readdata();
 obj.displaydata();
 getch();
 return 0;
}

C++ Codes Of Classes and Objects 1


Define a class student with the following specification
Private members of class student
admno                        integer
sname                        20 character
eng. math, science       float
total                            float
ctotal()                        a function to calculate eng + math + science with float return type.
Public member function of class student
Takedata()                   Function to accept values for admno, sname, eng, science and invoke ctotal() to calculate total.
Showdata()                   Function to display all the data members on the screen.




#include<iostream.h>
#include<conio.h>
#include<stdio.h>


class student
{
private:
 int admno;
 char sname[20];
 float eng,math,science;
 float total;
 float ctotal()
 {
  return eng+math+science;
 }
public:
 void Takedata()
 {
  cout<<"Enter admission number ";
  cin>> admno;
  cout<<"Enter student name " ;
  gets(sname);
  cout<< "Enter marks in english, math, science ";
  cin>>eng>>math>>science;
  total=ctotal();
 }

 void Showdata()
 {
  cout<<"Admission number "<<admno<<"\nStudent name "<<sname<<"\nEnglish "
   <<eng<<"\nMath "<<math<<"\nScience "<<science<<"\nTotal "<<total;
 }
};

int main ()
{
 clrscr();
 student obj ;
 obj.Takedata();
 obj.Showdata();
 getch();
 return 0;
}




Friday, March 1, 2013

C++ Array Codes


Write a C++ program to swap first and last element of an integer 1-d array.


#include<iostream.h>
#include<conio.h>

int main()
{
 int Arr[100],n,temp;
 cout<<"Enter number of elements you want to insert ";
 cin>>n;

 for(int i=0;i<n;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>Arr[i];
 }

 temp=Arr[0];
 Arr[0]=Arr[n-1];
 Arr[n-1]=temp;

 cout<<"\nArray after swapping"<<endl;

 for(i=0;i<n;i++)
  cout<<Arr[i]<<" ";

 getch();
 return 0;
}

******************************************************

Write a C++ program to find the sum and average of one dimensional integer array.

#include<iostream.h>
#include<conio.h>

int main()
{
 int Arr[100],n,sum=0;
 cout<<"Enter number of elements you want to insert ";
 cin>>n;

 for(int i=0;i<n;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>Arr[i];
 }

 for(i=0;i<n;i++)
  sum+=Arr[i];

 cout<<"\nThe sum of Array is :"<<sum;
 cout<<"\nThe average of Array is :"<<sum/i;

 getch();
 return 0;
}


******************************************************

Write a C++ program to reverse the element of an integer 1-D array.


#include<iostream.h>
#include<conio.h>

int main()
{
 int Arr[100],n,temp,i,j;
 cout<<"Enter number of elements you want to insert ";
 cin>>n;

 for(i=0;i<n;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>Arr[i];
 }

 for(i=0,j=n-1;i<n/2;i++,j--)
 {
  temp=Arr[i];
  Arr[i]=Arr[j];
  Arr[j]=temp;
 }

 cout<<"\nReverse array"<<endl;

 for(i=0;i<n;i++)
  cout<<Arr[i]<<" ";

 getch();
 return 0;
}
******************************************************

P is one-dimensional array of integers. Write a C++ function to efficiently search for a data VAL from P. If VAL is present in the array then the function should return value 1 and 0 otherwise.


#include<iostream.h>
#include<conio.h>

int lsearch(int Arr[], int s, int VAL);

int main()
{
 int Arr[100],n,val,found;
 cout<<"Enter number of elements you want to insert ";
 cin>>n;
 for(int i=0;i<n;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>Arr[i];
 }

 cout<<"Enter the number you want to search ";
 cin>>val;

 found=lsearch(Arr,n,val);

 if(found==1)
  cout<<"\nItem found";
 else
  cout<<"\nItem not found";

 getch();
 return 0;
}

int lsearch(int Arr[], int s, int VAL)
{
 for(int I=0; I<s; I++)
 {
  if(Arr[I]==VAL)
   return 1;
 }
 return 0;
}

******************************************************

Suppose X. Y, Z are arrays of integers of size M, N, and M + N respectively. The numbers in array X and Y appear in descending order. Write a user-defined function in C++ to produce third array Z by merging arrays X and Y in descending order.

#include<iostream.h>
#include<conio.h>

void Merge(int A[], int B[], int C[], int N, int M, int &K);

int main()
{
 int A[100], B[100], C[200],n,m,k;
 cout<<"\nEnter number of elements you want to insert in first array ";
 cin>>n;
 cout<<"Enter element in descending order\n";
 for(int i=0;i<n;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>A[i];
 }

 cout<<"\nEnter number of elements you want to insert in second array ";
 cin>>m;

 cout<<"Enter element in descending order\n";
 for(i=0;i<m;i++)
 {
  cout<<"Enter element "<<i+1<<":";
  cin>>B[i];
 }

 Merge(A,B,C,n,m,k);

 cout<<"The Merged Array in Descending Order"<<endl;
 for(i=0;i<k;i++)
 {
  cout<<C[i]<<" ";
 }

 getch();
 return 0;
}

void Merge(int A[], int B[], int C[], int N, int M, int &K)
{
      int I=0, J=0;
      K=0;
      while (I<N && J<M)
      {
     if (A[I]>B[J])
    C[K++]=A[I++];
     else if (A[I]<B[J])
    C[K++]=B[J++];
     else
     {
    C[K++]=A[I++];
    J++;
     }
      }
      for (int T=I;T<N;T++)
     C[K++]=A[T];
      for (T=J;T<M;T++)
     C[K++]=B[T];

}


Sunday, February 24, 2013

C++ Code Of If Else Statements 2


Any character is entered by the user; write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol.The following table shows the range of ASCII values for various characters.

Characters ASCII Values
A – Z 65 – 90
a – z 97 – 122
0 – 9 48 – 57
special symbols 0 - 47, 58 - 64, 91 - 96, 123 – 127



 

#include<iostream.h>
#include<conio.h>

int main ()
{
 char ch;
 cout<<"Enter any character:";
 cin>>ch;

 if (ch>=65 && ch<=90)
  cout<<"Character is a capital letter";
 else if (ch>=97 && ch<=122)
  cout<<"Character is a small letter";
 else if (ch>=48 && ch<=57)
  cout<<"Character is a digit";
 else if ((ch>0 && ch<=47)||(ch>=58 && ch<=64)||(ch>=91 && ch<=96)||(ch>=123 && ch<=127))
  cout<<"Character is a special symbol";

 getch();
 return 0;
}



**************************************************

Any character is entered by the user; write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol.The following table shows the range of ASCII values for various characters.




#include<iostream.h>
#include<conio.h>

int main()
{
 float basic_salary, gross_salary, HRA, DA;
 cout<<"Enter basic salary of Employee : ";
 cin>>basic_salary;

 if (basic_salary<1500)
 {
  HRA=0.1*basic_salary;
  DA=0.9*basic_salary;
 }
 else
 { 
  HRA=500;
  DA=0.98*basic_salary;
 }

 gross_salary=basic_salary+HRA+DA;
 cout<<"Gross salary is : "<<gross_salary;

 getch();
 return 0;
}


**************************************************


The marks obtained by a student in 5 different subjects are input by the user. The student gets a division as per the following rules:
Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
Write a program to calculate the division obtained by the student.




 

#include<iostream.h>
#include<conio.h>

int main()
{
 int sub1,sub2,sub3,sub4,sub5,percentage;
 cout<<"Enter marks of five subjects : ";
 cin>>sub1>>sub2>>sub3>>sub4>>sub5;
 percentage=(sub1+sub2+sub3+sub4+sub5)/5;

 if(percentage>=60)
  cout<<"Ist division";
 else if(percentage>=50)
  cout<<"IInd division";
 else if(percentage>=40)
  cout<<"IIIrd division";
 else
  cout<<"Fail" ;

 getch();
 return 0;
}