Saturday, March 1, 2014

Program to dispaly armstrong number between 1 to 500

#include<iostream.h>
int main()
{
int sum,n,temp,rem;
cout<<"The Armstrong number between the range 1 to 500 are : \n"; 
for(int x=1;x<=500;x++)
{
n=x;
sum=0;
temp=n;
do
{
rem=n%10;
n=n/10;
sum=sum+rem*rem*rem;
}while(n!=0);
if(sum==temp)
cout<<x<<"\t";
}
cout<<"\t";
return 0;
}


Output:
 The Armstrong number between the range 1 to 500 are :
1        153         370       371        407

C++ Program to check whether number is Armstrong number

#include<iostream.h>
int main()
{
      int sum,temp,rem,n;
     cout<<"Enter the number \n";
     cin>>n;
     cout<<" Entered number is \t";
     cout<<n;
     cout<<"\n";
     sum=0; 
     temp=n;
      do
        {
                rem=n%10;
                n=n/10;
                sum=sum+rem*rem*rem;
           }while(n!=0);
     if(sum==temp)
            cout<<"This is Armstrong number.\n";
   else
           cout<<"This is not Armstrong number.\n";
return 0;
}

Output:-
Enter the number
371
Entered number is    371
This is Armstrong number.

Friday, January 24, 2014

Microcontroller

Comparison between micro-controller and microprocessor

Sr No. Microcontroller Microprocessor
1. Inbuilt RAM or ROM Do not have inbuilt RAM or ROM
2. Inbuilt Timer Do not have inbuilt Timer
3. I/O ports are available I/o ports are not available ,requires extra device like 8155 or 8255.
4. Inbuilt serial port Do not have inbuilt serial port , requires extra devices like 8250 or 8251
5. Separate memory to store program and data Program and data are stored in same memory
6. Few instructions to read or write data to or from external memory. Many instructions to read or write data from or to external memory.


A microcontroller is an entire computer manufactured on a single chip. Microcontrollers are usually dedicated  devices embeded within an application
Example microcontrollers are used as engine controllers in engine automobiles and as exposure and focus controllers in cameras .

Features of 8051:-

  • 8 bit bus and 8 bit ALU.
  • 16 bit address bus  -64 KB of RAM and ROM.
  • On-chip RAM 128(256 ) bytes (Data Memory) and On Chip ROM -4 KB (Program memory)
  • Four 8 -bit bi directional input /output ports.
  • Programmable serial ports i.e. One UART(serial port).
  • Power saving mode.
  • All modern versions are CMOS.


Sunday, January 12, 2014

Computer Questions

Computer Questions




1.When data and acknowledgement are sent in the same frame ,this is called as
A) Piggy packing
B) Piggy backing
C) Back packing
D) Good packing

Answer:-B) Piggy backing



2.Encryption and Decryption is the responsibility of ________Layer.
A) Physical
B) Network
C) Application
D) Datalink 

Answer:- C) Application



3.An analog signal carries 4 bits in each signal unit .If 1000 signal units are sent per second ,then baud rate and bit rate of the signal are ____ and ____.
A) 4000 bauds \ sec & 1000 bps
B) 2000 bauds \ sec & 1000 bps
C) 1000 bauds \ sec & 500 bps
D) 1000 bauds \ sec & 4000 bps

Answer:- D) 1000 bauds \ sec & 4000 bps



4.The VLF and LF bauds use ______ propagation for communication.
A) Ground
B) Sky
C) Line of sight
D) Space

Answer:- A) Ground



5) Using the RSA public key crypto system ,if p=13 q=31 and d=7,then the value of e is
A) 101
B) 103
C) 105
D) 107

Answer:- 105



6)FAN IN of a component A is defined as
A) Number of components that can call or pass control to component A
B) Number of components that are called by component A.
C) Number of components related to component A.
D) Number of components dependent on component A.

Answer:-A) Number of components that can call or pass control to component A



7) The relationship of data elements in a module is called
A) Coupling
B)  Modularity
C) Cohesion
D) Granularity

Answer:- C) Cohesion



8)Software Configuration Management is the discipline for systematically controlling
A) the changes due to the evolution of work products as the project proceeds.
B) the changes due to defects (bugs) being found and then fixed
C)the changes due to requirement changes
D) all the above

Answer:- D) all the above




9) Which one the following is not a step of requirement engineering?
A) Requirement elicitation
B) Requirement analysis
C) Requirement design
D) Requirement documentation

Answer:- C) Requirement design



10)Testing of software with actual data and in actual environment is called
A) Alpha testing
B) Beta testing
C) Regression testing
D) None of the above

Answer:- B) Beta testing



11) The student marks should not be greater than 100 .This is
A) Integrity constraint
B) Referential constraint
C) Over-defined constraint
D) Feasible constraint

Answer:- A) Integrity constraint



12) Which of the following operators can not be overloaded in C++?
A) *
B) +=
C) ==
D) ::

Answer :- D) ::





Tuesday, January 7, 2014

Tuesday, December 31, 2013

Happy New Year

2013

WISH YOU HAPPY AND PROSPEROUS NEW YEAR


Welcome to 2014


Make this year with full of joy and happiness in this world.
Let there be peace, growth and mankind with enjoyment this year.
Think always Positive to change the world.
Think Good and big to become Big.
Thanks God.
May God bless you.

Happy New year 2014

Again 365 days starts in looping.

Thursday, December 26, 2013

Programs of microprocessor

Programs of microprocessor




Microprocessor cannot understand a program written in Assembly Language .
Instruction are divided into bit pattern of word in byte as op-code(operation code) and operation.

Instruction format has three types
1.One byte-has op-code
2.Two byte- has op-code and address
3.Three byte -has code and address lower byte and address higher byte

opcode

1 byte

 
opcode
Data / address

2 byte

 
opcode
Data / address Lower byte
Data Address Higher byte

3 byte



Instructions set for 8085 are classified into five categories:

1.Data transfer group instructions
2.Arithmetic group of instructions
3.Logical group
4.Branching group
5.Machine Level
 
A program known in Assembler is used to covert a Assembly language program to machine language.

I) Data transfer copy operation:-


1)Load a 8 bit number in a register
2)Copy from Register to Register
3)Copy between Register and Memory
4)Copy between Input/Output Port and Accumulator
5)Load a 16 bit number in a Register pair
6) Copy between Register pair and Stack memory

Example :-
1.Load a 8 bit number 4F in register B                     -MVI   B ,4FH
2.Copy from Register B to Register A                     -MOV  A,B
3.Load a 16 bit number 2050 in Register pair HL     -LXI     H,2050H
4.Copy from Register B to Memory Address 2050  - MOV   M,B
5.Copy between Input/Output Port and Accumulator- OUT   01H      IN   07H

2)Arithmetic operations and instructions


1.Add 8 bit number 32 H to Accumulator                   -ADI   32 H
2.Add contents of Register B to Accumulator            - ADD B
3.Subtract a 8 bit number 32 H from Accumulator      - SUI   32H
4.Subtract contents of Register C from Accumulator   -SUB  C
5.Increment the contents of Register D by 1                - INR   D
6.Decrement the contents of Register E by 1               -  DCR   E

3)Logical and Bit Manipulation operations and instructions


1.Logically AND Register H with Accumulator             -ANA  H
2.Logically OR Register L with Accumulator                 -ORA   L
3.Logically XOR Register B with Accumulator             - XRA   B
4.Compare contents of Register C with Accumulator  -CMP  C
5.Complement Accumulator                                            -CMA
6.Rotate Accumulator Left                                             -RAL

Program to add two 8 bit numbers and store result in register C


1.Get two numbers
a) Load first no. in register D                                        MVI   D , 2H
b)Load  second no. in register E                                    MVI   E , 3H

2.Add them
a) Copy register D to A                                                  MOV  A , D
b) Add register E to A                                                     ADD E

3. Store result
a)Copy A to register  C                                                  MOV  C , A

4.Stop
a)Stop processing                                                            HLT


Program to add 8 bit number result can be more than 8 bits i.e.with carry present


1.Get two numbers
a) Load first no. in register D                                        MVI   D , 2H
b)Load  second no. in register E                                    MVI   E , 3H

2.Add them
a) Copy register D to A                                                  MOV  A , D
b) Add register E to A                                                     ADD E

3. Store result
a)Copy A to register  C                                                  MOV  C , A

4.Carry
a)Use conditional Jump instructions                           JNC  END

5.Change
a)Clear register B                                                          MVI  B ,0H
b)Increment B                                                                INR  B

6.Stop
a)Stop processing                                                         HLT


Sunday, December 22, 2013

Solve

SOLVE
 1) Find the odd man out - 49,  81 ,100 ,144
A) 49
B) 81
C) 100
D) 144


2)Which of the following numbers is different from others?
A) 3156
B) 4164
C) 5255
D) 6366


3)Fill the blank
5,35,7,42,6 ,_____,9,36,4.
A) 45
B) 48
C) 54
D) 56 


4)Find odd man out :DFEG,  JKLM,   GHIK,   RTSU
A) DFEG
B)JKLM
C)GHIK
D)RTSU


5) find odd man out 1,3,10,21,64,129,256,778
1) 10
2) 21
3) 129
4) 256


6)The missing number in the series is:
0 , 6 , 24 , 60 , 120 , ? , 336 is
A) 240
B) 220
C) 280
D)210


7)Let a means minus (-) ,b means multiplied by (*), C means divided by (/) and D means plus(+).The value of 90 D 9 a 29 C 10 b 2
A) 8
B) 10
C) 12
D) 14


8)If MOHAN is represented by the code KMFYL, then COUNT will be represented by
A) AMSLR
B) MSLR
C) MASRL
D)SAMLR


9)  32     33      37    46     62    ?
Replace ? by
A)85
B) 87
C) 94
D) 99


10)AZ       DW        GT       JQ     ? .Replace ? from following
A) LD
B) MN
C) MO
D) NM


11) In certain code language ,PUNE is written as SXQH.How would you write DELHI in this language?
A )  FGNJL
B )  FGNJK
C )  GHOKM
D )  GHOKL


12)Find odd man out:
A)  6
B ) 18
C )  24
D )  36


13)Find the wrong term in the following series:
68    66     62    59     56    53
A)  59
B)  62
C)  66
D)  68


14)If P is the brotherb of Q;Q is the son of R; Sis R's father .What is P of S?
A)  Son
B)  Brother
C)  Grandson
D)  Grandfather

15) The missing number in the series 40 , 120 , 60 , 180 , 90 , ? , 135
A)  110
B)  270
C)  105
D)  210


16) The length and breadth of  a rectangle are changed by +20% and by -10% respectively.What is the percentage change in the area of rectangle?
A)  10%
B)  12.5%
C)  8%
D)  15%


17) Two pipes A and B can fill a tyank in 15 minutes and 20  minutes respectively .Both the pipes are opened together but after 4 minutes,pipe A is turned off. What is the total time required to fill the tank?
A) 10 min.40 sec
B) 11 min.45 sec
C) 12 min.30 sec
D)  14 min.40sec


18)The odd number from 1 to 45 which are exactly divisible by 3 are arranged in an ascending order .The number at 6th position is
A)  18
B)  24
C)  33
D)  36


19) If the radius of a circle is increased by 50%, the perimeter of the circle will increase by

A) 30
B)  85/2
C)  170/3
D)  110

20) In code language, the word BAD is written as 658 .In the same language, what could be the code for FIG?
A)  9         12       10
B) 10        13        11
C) 8          11       13
D) 10        12       13

Wednesday, December 18, 2013

More C++ programs




//Program to display Floyd triangle:-


#include<iostream.h>
main()
{
    int line,i,num=1,incr;
    cout<<" How many lines = ";
    cin>>line;
    cout<<"\n \n Floyds Triangle \n \n";
    for(i=1;i<=line;i++)
    {
        for(incr=1;incr<=i;incr++)
        {
            cout<<num;
            cout<<"\t";
            num++;
        }
        cout<<"\n";
    }
}


Output:-


How many lines = 7

Floyds triangle


1
2           3
4           5           6
7           8           9           10
11         12         13         1 4          15
16         17         18         19            20          21
22          23         24         25           26          27          28



//Program to check whether number is prime or not:-


#include<iostream.h>
main()
{
    int num,temp=0,i;
    cout<<"\n Enter the number =";
    cin>>num;
    if(num>0)
    {
        for(i=2;i<=num-1;i++)
        {
            if(num%i==0)
            {
                cout<<"\n Number is not a Prime number \n \n";
                temp=1;
                break;
            }
        }
        if(temp==0)
        {
            cout<<"\n Number is Prime \n \n";
        }
    }
    else
        cout<<"Enter only Positive numbers";
}


Output:-


Enter the number = 7
Number is Prime

//Program of destructors in c++:-

#include<iostream.h>
class ABC
{
int *width,*height;
public:
    ABC(int,int);
    ~ABC();
        int area()
    {
            return(*width**height);
    }
};
ABC::ABC(int a,int b)
{
width=new int;
height= new int;
*width=a;
*height=b;
}
ABC::~ABC()
{
    delete width;
    delete height;
   
}
main()
{
    ABC obj1(4,9),obj2(7,5);
    cout<<obj1.area();
    cout<<"\n";
    cout<<obj2.area();
}


Output :-

36
35

//Program of static member variable and member function:


#include<iostream.h>
class ABC
{
private :static int data;
public: static void getdata()
        {
            ++data;
            cout<<"count is =";
            cout<<data<<"\n";
        }
     void putdata()
        {
            ++data;
            cout<<"now count is ="<<data<<"\n";
        }
 void newfunction()
{
++data;
cout<<"now count is ="<<data;
}
};
int ABC::data=5;
void main()
{
    ABC obj;
    ABC::getdata();
    obj.putdata();
    obj.newfunction();
}

Output:-

count is =6
now count is =7
now count is =8


Featured posts

Mongolia

 Mongolia! Mongolia is a vast and sparsely populated country in East Asia, known for its stunning natural beauty, rich history, and unique c...

Popular posts