Sunday, 27 August 2017

c program for inter-process communication using double pipe (with algorithm)

c program for inter-process communication using double pipe (with algorithm)

aim : to implement inter-process communication using double pipe

algorithm :

step 1 : start
step 2 : declare p1,p2,buff1[25],buff2[25],pid
step 3 : call system calls pipe(p1),pipe(p2)
step 4 : call the fork and initialize pid
step 5 : check if pid==0 then goto step 6 else goto step 11
step 6 : read the message to parent and store on buff1
step 7 : write the message to child using pipe p1
step 8 : call sleep()
step 9 : read the message from parent using pipe p2 and store in buff1
step 10 : print the message from parent
step 11 : read the message from child using pipe p1
step 12 : print the message from child
step 13 : read the message from child
step 14 : write the message to child using pipe2
step 15 : stop

C PROGRAM FOR INTER-PROCESS COMMUNICATION USING SINGLE PIPE (WITH ALGORITHM)

C PROGRAM FOR INTER-PROCESS COMMUNICATION USING SINGLE PIPE (WITH ALGORITHM)

AIM : TO IMPLEMENT INTERPROCESS COMMUNICATION USING SINGLE PIPE

ALGORITHM :

STEP 1 : START

STEP 2 : DECLARE P[2],PID,BUFF

STEP 3 : CALL THE SYSTEM CALL PIPE(P)

STEP 4 : CREATE A PROCESS

STEP 5 : IF THE PROCESS IS CHILD THEN GO TO STEP 6

STEP 6 : READ THE MESSAGE FOR PARENT

STEP 7 : WRITE THE MESSAGE TO PARENT

STEP 8 : CALL SLEEP()

STEP 9 : READ THE MESSAGE FROM PARENT

STEP 10 : PRINT THE MESSAGE FROM PARENT

STEP 11 : IF THE PROCESS IS PARENT, GO TO STEP 12

STEP 12 : READ THE MESSAGE FROM CHILD

STEP 13 : DISPLAY THE MESSAGE FROM CHILD

STEP 14 : READ THE MESSAGE FROM CHILD

STEP 15 : WRITE THE MESSAGE TO CHILD

STEP 16 : STOP


PROGRAM :

#include<stdio.h>
#include<string.h>
void main()
{
     int pid,p[2];
     char buff[20];
     pipe(p);
     pid=fork();
     if(pid==0)
     {
         printf("\n child process \n");
         printf("\n enter the message to parent : \n");
         gets(buff);
         write(p[1],buff,sizeof(buff));
         sleep(8);
         printf("\n message from parent : \n");
         read(p[0],buff,sizeof(buff));
         puts(buff);
         close(p[0]);
    }
    else
    {
         printf("\n parent process ");
         read(p[0],buff,sizeof(buff));
         printf("\n message from child : ");
         puts(buff);
         sleep(4);
         printf("\n enter the message to child : ");
         gets(buff);
         write(p[1],buff,sizeof(buff));
         sleep(2);
         close(p[0]);
    }
}


OUTPUT :

parent process
child process
enter the message to parent :
hai
message from child :
hai
enter the message to child :
hai
message from parent : hai



C PROGRAM TO IMPLEMENT FORK SYSTEM CALL (WITH ALGORITHM)

C PROGRAM TO IMPLEMENT FORK SYSTEM CALL (WITH ALGORITHM)

AIM : TO IMPLEMENT FORK SYSTEM CALL

ALGORITHM :

STEP 1 : START

STEP 2 : CREATE A CHILD PROCESS USING FORK

STEP 3 : IF THE PROCESSID EQUALS 0 GOTO STEP 4 ELSE GOTO STEP5

STEP 4 : IT IS A CHILD PROCESS AND GET ITS ID AND PARENT PROCESSID

STEP 5 : IF PROCESSID>0 IT IS A PARENT PROCESS AND GET ITS ID

STEP 6 : HANDLE THE SYSTEM INTERRUPT(ERROR)

STEP 7 : STOP


PROGRAM :

#include<stdio.h>
void main()
{
   int pid;
   pid=fork();
   if(pid==0)
   {
        printf("\n child process ");
        printf("\n pid of child process : %d \n pid of parent process : %d\n",getpid(),getppid());
   }
   else if(pid>0)
       printf("\n parent process : %d",getpid());
   else
       printf("\n error");
}


OUTPUT :

parent process : 3248
child process
pid of child process : 3249
pid of parent process : 1









Saturday, 26 August 2017

MASM PROGRAM FOR STRING REVERSAL (WITH ALGORITHM)

MASM PROGRAM FOR STRING REVERSAL (WITH ALGORITHM)

AIM : TO REVERSE A STRING

ALGORITHM :

STEP 1 : WRITE THE DATA SEGMENT

STEP 2 : MOVE DATA TO AX

STEP 3 : MOVE AX TO DS

STEP 4 : LOAD EFFECTIVE ADDRESS OF MSG1 TO DX

STEP 5 : PRINT MESSAGE

STEP 6 : MOVE 0DH TO DL

STEP 7 : LOAD EFFECTIVE ADDRESS OF ST1 TO S1

STEP 8 : MOVE 00H TO CL

STEP 9 : INPUT A CHARACTER

STEP 10 : COMPARE IF IT IS A LINE FEED

STEP 11 : JUMP IF ZERO TO STEP 18

STEP 12 : INCREMENT CL

STEP 13 : INCREMENT SI

STEP 14 : MOVE AL TO THE CONTENT OF SI

STEP 15 : INCREMENT SI

STEP 16 : INCREMENT CL

STEP 17 : JUMP TO STEP 9

STEP 18 : MOVE 0AH TO DL

STEP 19 : MOVE 0DH TO DL

STEP 20 : LOAD EFFECTIVE ADDRESS OF MSG2 TO DX

STEP 21 : PRINT THE MESSAGE

STEP 22 : MOVE THE CONTENT OF SI TO DL

STEP 23 : PRINT THE CHARACTER WHERE VALUE IN DL

STEP 24 : DECREMENT SI

STEP 25 : DECREMENT CL

STEP 26 : COMPARE 00H TO CL

STEP 27 : JUMP IF NOT ZERO TO STEP 21

STEP 28 : TERMINATE THE PROGRAM

STEP 29 : STOP


PROGRAM :

DATA SEGMENT
            ST1 DB 100 DUP(?)
            MSG1 DB "ENTER THE STRING $"
            MSG2 DB "REVERSED STRING $"
DATA ENDS

CODE SEGMENT
            ASSUME CS:CODE
            START:
                         MOV AX,DATA
                         MOV DS,AX
                         LEA DX,MSG1
                         MOV AH,09H
                         INT 21H
                         LEA SI,ST1
                         MOV CL,00H
           L1:
                         MOV AH,01H
                         INT 21H
                         CMP AL,0DH
                         JZ L2
                         INC CL
                         INC SI
                         MOV [SI],AL
                         INC SI
                         INC CL
                         JMP L1
          L2:
                         MOV DL,0AH
                         INT 21H
                         MOV DL,0DH
                         INT 21H
                         LEA DX,MSG2
                         MOV AH,09H
                         INT 21H
         L3:
                         MOV DL,[SI]
                         MOV AH,02H
                         INT 21H
                         DEC SI
                         DEC CL
                         CMP CL,00H
                         JNZ L3
                         MOV AH,4CH
                         INT 21H
        CODE ENDS
        END START


OUTPUT :

ENTER THE STRING : CAT
REVERSED STRING : TAC






























MASM PROGRAM TO CONVERT THE CASE OF A CHARACTER (WITH ALGORITHM)

MASM PROGRAM TO CONVERT THE CASE OF A CHARACTER


AIM : TO CONVERT THE CASE OF A CHARACTER

ALGORITHM :

STEP 1 : INPUT THE CHARACTER

STEP 2 : MOVE THE CHARACTER IN AL TO CL

STEP 3 : MOVE CL TO DL

STEP 4 : COMPARE DL WITH 01H

STEP 5 : JUMP IF CARRY TO 8

STEP 6 : SUBTRACT DL WITH 20H

STEP 7 : JUMP IF NO CARRY TO 9

STEP 8 : ADD DL WITH 20H

STEP 9 : PRINT THE CHARACTER

STEP 10 : TERMINATE THE PROGRAM

STEP 11 : STOP


PROGRAM :

CODE SEGMENT
ASSUME CS: CODE
                START:
                             MOV AH,01H
                             INT 21H
                             MOV CL,AL
                             MOV DL,CL
                             CMP DL,61H
                             JC L1
                             SUB DL,20H
                             JNC L2
                             L1:
                                     ADD DL,20H
                             L2:
                                    MOV AH,02H
                                    INT 21H
                                    MOV AH,4CH
                                    INT 21H
                            CODE ENDS
              END START


OUTPUT :

aA







MASM PROGRAM TO DISPLAY "HELLO" (WITH ALGORITHM)


MASM PROGRAM TO DISPLAY "HELLO" (WITH ALGORITHM) 


AIM : TO DISPLAY HELLO

ALGORITHM :

STEP 1 : WRITE DATA SEGMENT

STEP 2 : MOVE DATA TO AX

STEP 3 : MOVE AX TO DS

STEP 4 : DISPLAY THE MESSAGE IN DS

STEP 5 : PROGRAM TERMINATES

STEP 6 : STOP


PROGRAM :

DATA SEGMENT
          MSG DB "HELLO$"
DATA ENDS
CODE SEGMENT
          ASSUME CS:CODE,DS:DATA
START:
          MOV AX,DATA
          MOV DS,AX
          LEA DX,MSG
          MOV AH,09H
          INT 21H
          MOV AH,4CH
          INT 21H
          CODE ENDS
END START


OUTPUT :

HELLO






Monday, 7 August 2017

Subject and Predicate & Kinds of Sentences

Subject and Predicate
                                                                       Courtesy: Cordova Learning Series
A sentence has two parts:

(a) Subject

(b) Predicate

eg: Rahul likes playing football.

This is a sentence that makes complete sense.

'Rahul' is the subject because the sentence is about Rahul.

'likes playing football' is the predicate because it tells us about the subject 'Rahul'.

  • The part of the sentence that tells us what or whom the sentence is about is called the subject.


  • The part of the sentence that tells us something about the subject is called the predicate.


Eg: The players are not tired.

Subject : The players       Predicate: are not tired

  • The predicate always includes the verb.


More examples to understand subject and predicate


1) The boy was chasing a cat

Subject: The boy predicate: was chasing a cat

2) Suraj is sleeping.

Subject : Suraj     Predicate: is sleeping

  • The subject may have only one or more than a word.


Subject in commands

(i)Come here  (ii) Don't talk

In these sentences, the subject is not mentioned.

The subject is actually 'you' and the sentences actually read like the following:

(i) You come here  (ii)You don't talk

In all commands, the subject is 'you' which is not mentioned in the sentence but is understood.

Subject in questions

The subject usually comes before the predicate. But, in questions, subjects come after predicates.

Eg: (i) Where is mother ?

Subject : mother Predicate: Where is

(ii) Who are you ?

Subject : you  Predicate: Who are

Let's revise

  • A sentence has two parts : subject and predicate
  • In commands, the subject is 'you' which is not mentioned but implied.
  • In questions and exclamatory sentences, predicates usually come before the subjects.



Kinds of Sentences

There are four kinds of sentences.

1) Statements

2) Interrogative sentences

3) Imperative sentences

4) Exclamatory sentences

  • A statement says or states something. It begins with a capital letter and ends with a full stop.



Eg: 1) I like water melons.


2) I love to paint pictures.

  • An interrogative sentence or question asks something. It begins with a capital letter and ends with a question mark.


Eg: 1) What is your name?


2) Did you meet Mr. Verma?

  • An imperative sentence requests, commands or gives directions. It usually begins with a verb. It begins with a capital letter and ends with a full stop.



Eg: 1) Switch off the fan.


2) Please, come to me.

  • An exclamatory sentence expresses a strong feeling or emotion. It ends with an exclamation mark.



Eg: 1) What a beautiful picture it is!


2) How fast is she running!

Tuesday, 1 August 2017

Best phones under ₹ 10,000 in India for August 2017

Xiaomi Redmi 4


  • 13MP primary camera with 5-elements lens, f/2.2 aperture, PDAF, high dynamic range (HDR), panorama, 1080p full HD video recording and 5MP front facing camera
  • 12.7 centimeters (5-inch) display with 1280 x 720 pixels resolution and 293 PPI pixel density
  • Android v6.0.1 Marshmallow operating system with up to 1.4GHz Qualcomm Snapdragon 435 octa core processor with Adreno 505 GPU, 3GB RAM, 32GB internal memory expandable up to 128GB and dual SIM (micro+nano) dual-standby (4G+4G)
  • 4100mAH lithium-ion battery providing talk-time of 36 hours and standby time of 432 hours
  • 1-year manufacturer warranty for device and 6 months manufacturer warranty for in-box accessories including batteries from the date of purchase
Yu Yureka Black 

With a superior metal finish, the Yureka Black is designed to impress. Boasting 4 GB of RAM and a 1.4 GHz Qualcomm Snapdragon 430 octa-core processor, this smartphone packs quite a punch, making every task smooth and fast. Its 13 MP Sony IMX 258 rear camera helps you capture life’s beautiful moments in picture-perfect photos. The 8 MP selfie camera of the Yureka Black, with its selfie flash, lets you take stunning selfies even in poorly lit conditions. Watch movies, play games or shop online - the 12.7 cm (5) FHD IPS display is made to offer an impressive viewing experience. The 3000 mAh battery of this smartphone keeps the fun going on for up to two days on a single full charge. To top it off, the fingerprint sensor of this phone keeps all your private data truly private from prying eyes.



Thursday, 20 July 2017

How to study - 99.99% success ensured

Some study hard, even though they end up scoring fewer marks. Why so?
Some are lazy to study. Why so?
Well, the answer for all these lies in this article.
An efficient study technique includes 5-W's and 2-H's. Who, Why, When, Where, What, How, and How much.

1)Who - who all are included in an efficient studying technique? Surely you are there. You can also include your parents, brothers, sisters, and friends in that list. You may be thinking why should I include them. Well, the answer is that you can cross check with the above people the things you have studied. You should discuss tough topics with your friends. They may be knowing some of the portions better than you.Also, they may have doubts that you wouldn't have even thought of. If you discuss all these things together it will help in eradicating most of the doubts or else you could approach your teacher for clarifying your doubts. You and your friends must take the combined study seriously otherwise will end up in sheer wastage of time.

2)Why -your performance decides your future life whether it be higher studies or work.

3)When - here comes the time planning on daily studies. Stick to your time plan.

4)Where - you should select a place having good air flow, good light system, and essential furniture to study. Don't be sad if you don't have all the essential things. Place your books in a clean corner so that you can easily pick up the needed one. A chair and a table are more preferred. Or you can use a cardboard for your writing purpose.


5)What - plan your studies according to the exam. Try to study the things taught on that day itself. If needed you can reduce the time for rest or sleeping, but you should make it up on the holidays.

6)How - (i) sit straight
(ii) light should fall on your book from the left side.
(iii) need concentration.
(iv) read and understand fast. On the first read, try to understand the important points, words, and sentences. This will reduce the time required for repeated studies.

7)How much - decide the portion to be covered in certain time limit. Similarly, decide on the things to be studied from a chapter on that day. This will help in concentrating much on your studies. Otherwise, you may be simply wasting time by reading the same portion again and again.

Try to read and understand as many words as possible, at a time 5-6 words. Improve your vocabulary daily using dictionary or newspaper. Not knowing the meaning of words will hamper the reading speed and understanding. Read in your mind. Reading aloud or using your lips will exhaust you. Don't move fingers over the line to be read this will reduce the speed of reading. During appropriate instances bring into use the learned things. Think about the things learned, during day time. Repeatedly revise the important topics and chapters. Share the things you have learned with your friends.

Wednesday, 19 July 2017

Healthy food habits / Veg vs Non-veg / Communication skill

Food habits to be followed for a healthy body

Just like petrol for a car, food is important for our body. You should not eat too much food as this may slow down the processing power of the brain and will make you lazy. Today the use of chemical fertilisers have made all things polluted. So we should wash well vegetables and fruits prior use. The younger generation is more attracted towards the gas filled drinks such as Coca- Cola, Fanta, Pepsi etc. They consider drinking it as a fashion or proud. The news about the poison content in these drinks is now out. We should completely avoid these drinks. Just rely on the fresh natural fruit juices. 

Veg vs non-veg

Most of the scientists all over the world have found out that veg. food habit is best for the health. Veg. Food habit is now in tremendous growth among all. World vegetarians association once gave Dr. A P J Abdul Kalam the award for the best vegetarian. 

Healthy food habits

1) if you are fat, add honey and lemon juice to little warm water and drink in the morning. This helps in reducing the weight of the body.
2) if you are lean, add honey to milk and drink. Also, eat dry date palm.

3) at night put almonds in water, peel off its skin and eat in the morning.

4) avoid eating more chillies, salt, sweets etc.

5) avoid junk and fast food.

6) eat spinach as salad or chutney - this will help in improving memory.

7) eat papaya - prevents cancer, blood pressure, constipation, heart problems, kidney diseases.Also, helps in improving eyesight.

8) grape juice - prevents breast cancer, jaundice, kidney and heart problems 

We have to drink 2-3 litres of water daily. After waking up drink 400-800 ml water, this will clean your stomach and digestive system. We can live without food for days but can't live without water. Water is necessary for better blood flow. When your body gets enough water our face and skin will become brighter. 

Human beings are social animals. A life alone for a human is impossible. By interacting with people love, friendship, care etc will get generated in students. Students must develop a good social relationship during their school days itself. So that unity and peace can be ensured in their personal and social life. We have to improve our communication skills. To fulfil our needs and requirements we must be capable enough in communicating them with others. Communication is a management skill required for the success of a person. You should learn to communicate well with your parents, teachers, friends, colleagues. Good communication skill can provide us with leadership skills to accomplish the given tasks. Communication can be written or spoken. You must learn to cope with all type of people. You need to develop good habits. You must be disciplined. Throw away all the bad habits which destroy your valuable time, energy and life. Improve and develop your skills.  Always root in reality.  



Monday, 17 July 2017

How to excel in exams

Do not compare yourself with others

If your parents or teachers defame you by comparing with intelligent students you don't need to be egoistic or feel any inferiority complex. Actually, they are not supposed to do so. But they speak so in order to inculcate the desire to study in you. They think that by doing so you will become competitive with the above-mentioned intellectuals. But that will only lead in developing ego and inferiority complex in you.

Go ahead by deciding your goals

At the same time, you shouldn't be lazy as before. Suppose that you have only scored 50% marks in an exam. Then you should make a firm decision that you will be scoring between 70-80% marks in the next exam. Along with this decision, you would have to hard-work for it sincerely. You wouldn't be able to score 90-95% marks in the first attempt itself. You can advance only through small steps. At the same time set up high targets for other subjects as well and advance forward. Try to remember the below-mentioned points while doing all these.

1) thoroughly examine the answer sheet of the subject of which you scored only 50% marks.

2) find the mistakes you made. Find out the reasons for low scoring.

3) try to avoid those type of mistakes as well as try to study the lessons which you couldn't study well.

4) if necessary discuss the undigested topics with your friends. This will help in understanding the topic and also will help in enhancing your performance in exams.

Don't repent

Don't repent even if you have scored less than 40% marks. If you are confident and are ready to implement the things mentioned above you can score good marks. God or nature has created each and every uniquely. We can't compare one with another. You may have your own skills- drawing, painting, music, sports etc. You may be one among the best in any of these fields, even though you need to have a basic qualification of higher secondary, otherwise, others may not give value for you. So plan yourself to excel more. Set the targets of 60,70% marks for the coming exams.
Try to follow the instructions mentioned till now.Don't procrastinate anything. Study the lessons taught in the same-day itself. This will help in managing your time as well as for preparing best for the exam.

Steps to be followed for best performance

1) best planning and exercising of duties
     i) try to read fast and understand fast.
     ii) maintain a good handwriting.

2) good knowledge of the language - spelling, sentence making etc. The wrong usage of language will cut off your marks in language subjects. For other subjects, two or three language errors will be accepted.

3) better memory power

4) better presentation

Human computer

Our brain which is responsible for reading and learning is more efficient than computers. We have to utilize it well. Even the most intellectuals are not using the full capacity of their brains. Some scientific findings,
1) left part of the brain is related to logical thinking, idea making and the making of words.
2) right part of the brain is related to imagination and conceptualization.


Sunday, 16 July 2017

How to maintain a healthy body?



How to maintain a healthy body?

1) maintain healthy habits
2) proper exercises and games
3) enough sleep and rest
4) good food habits

Our body's working is even more complicated than the new generation computers. If we maintain our body correctly, it will provide us a happy and successful life.

Wake up early in the morning

If we wake up in the morning between 5 and 6 we would be able to hear the chirping of birds. How energetic they are!
Nowadays most of the students like to sit for a long time in the night rather than waking up early in the morning. These students awake very late in the morning. Sleeping early(around 10 pm) and waking up early in the morning is good for health. Morning time is good for learning and by-hearting.
You may argue that since the night time is calm you will be able to concentrate on your studies.That's right but morning time is calm as well as your body and mind will be fresh and energetic then. You won't get this freshness and energy during the night time. Your mind and body will be tired since you have worked for the whole day. During the exam time, this is not a problem. But for regular studies, morning time is best. Even modern science proves this right.

If you wake up usually at 7 or 8 then you should change this habit gradually. Try to wake up at 6:30 in the first time, then at 6 in the next month, thus learn to wake up early in the morning and study. There is a biological clock under the control of the hypothalamus in our brain. If you repeatedly wake up at 6  in the morning for 7 days then on the 8th day this biological clock will work and wake you up at 6  in the morning. Also if you order your brain two or three times(before going to sleep) to wake up at 6 in the morning then
you will be able to wake up at 6 in the morning.

Cleaning the teeth

You will be aware of the fact that cleaning of teeth before bed is a necessity. This is a big issue. Problems of teeth will lead to many health issues. This is proven. You must clean your toothbrush daily. Clean your teeth in the upper row by brushing from upper to lower, and clean your teeth in the lower row by brushing from lower to upper. You should clean the inner parts of the mouth using a brush. These habits will make your teeth stronger and healthy. You should clean your tongue using metal or plastic tongue cleaners. This is necessary to stimulate the taste buds in your tongue.

Bathing

Bathing improves your blood flow and makes you energetic. When you rub and clean your body after applying soap or herbal powders, dead cells will get removed and pores for sweating will get opened. You shouldn't bath immediately after exercising. Also, you shouldn't bath while you are sweating. It's better to bathe in cold water during the summer season. The temperature of water used for bathing must be below 98-degree Fahrenheit. Some people put neem leaves in the water before bathing, this is good for skin. Bathing after walking or exercising in the evening is good. This will maintain you energetic. 

Saturday, 15 July 2017

Operator Precedence Parser algorithm & program in c




(If you have any doubts regarding the concept and working of operator precedence parser then refer  the following video)



PART 1




PART 2


Algorithm

1) Set input pointer ip to point to the first symbol of w$

2) Repeat forever
 
    if $ is on top of the stack and ip points to  $

        return
 
    else
 
        begin
 
            let a be the top most terminal symbol on the stack

            and let b be the symbol pointed by ip.

            if a<b or a=b then

                begin

                     push b into the stack.
 
                     advance ip to the next input symbol.

                end

           else if a>b then

                repeat pop the stack until the top of the stack terminal is related by < to the

                terminal most recently popped.

           else

                error

       end
     

    Program ( in c )



#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
int k,w,e,q,length,rhslength,len,plength,row;
int column,i,y,u,valid,v,begin,top,z;
char aa,bb,temp,term[10],rhs[10],token[25],stack[20],nt,handle[10],tm;
char table[10][10]={
   {' ','+','-','*','/','^','i','(',')','$'},
   {'+','>','>','<','<','<','<','<','>','>'},
   {'*','>','>','<','<','<','<','<','>','>'},
   {'/','>','>','>','>','<','<','<','>','>'},
   {'^','>','>','>','>','<','<','<','>','>'},
   {'i','>','>','>','>','>',' ',' ','>','>'},
   {'(','<','<','<','<','<','<','<','=',' '},
   {')','>','>','>','>','>',' ',' ','>','>'},
   {'$','<','<','<','<','<','<','<','>','>'}
};
char production[9][10]={
{'E','-','>','E','A','E','\0'},
{'E','-','>','(','E',')','\0'},
{'E','-','>','-','E','\0'},
{'E','-','>','i','\0'},
{'A','-','>','+','\0'},
{'A','-','>','-','\0'},
{'A','-','>','*','\0'},
{'A','-','>','/','\0'},
{'A','-','>','^','\0'},
};
void find_row_for_a(char a){
  int j;
  for(j=0;j<=10;j++){
  if(table[j][0]==a)
  break;
  }
 row=j;
 if(j==10){
  printf("\n String is not accepted");
  getch();
  exit(0);
  }
}
void find_column_for_b(char b){
 int j;
  for(j=0;j<10;j++){
  if(table[0][j]==b)
  break;
 }
  column=j;
  if(j==10)
  {
  printf("\n String is not accepted");
  getch();
  exit(0);
}
}
void push(char info)
{
 top++;
  stack[top]=info;
  for(k=0;k<length;k++)
  token[k]=token[k+1];
  length--;
  token[length]='\0';
}
void get_rhs(){
 e=0;
 plength=strlen(production[y]);
  nt=production[i][0];
  while(production[y][e]!='>')
  e++;
 e++;
  q=0;
  while(e<plength){
  rhs[q]=production[y][e];
  e++;
  q++;
  }
if((rhs[1]=='A'&&(handle[1]=='+')||(handle[1]=='*')||handle[1]==
'-')||(handle[1]=='^')||(handle[1]=='/'))
  rhs[1]=handle[1];
  rhs[q]='\0';
 rhslength=strlen(rhs);
}
void reduce(){
 for(y=0;y<9;y++){
  get_rhs();
  if(strcmp(rhs,handle)==0){
    top++;
    stack[top]=nt;
  break;
  }
 }
  if(y==9){
  printf("\n String is not accepted");
  getch();
  exit(0);
  }
  stack[top+1]='\0';
}

void check_for_precedence(){
  aa=stack[top];
  z=top;
  while(aa=='E'||aa=='A'){
  z--;
  aa=stack[z];
  }
  bb=token[i];
  find_row_for_a(aa);
  find_column_for_b(bb);
  if(table[row][column]=='<'||table[row][column]=='=')
  push(bb);
  else if(table[row][column]=='>'){
  u=0;
  while(top>=0){
  if(stack[top]=='E'||stack[top]=='A'){
    while(stack[top]=='E'||stack[top]=='A'){
    term[u]=stack[top];
    top--;
    u++;
    }
  }
  term[u]=stack[top];
  tm=stack[top];
  top--;
  while(stack[top]=='E'||stack[top]=='A'){
    u++;
    term[u]=stack[top];
    top--;
    }
    temp=stack[top];
    find_row_for_a(temp);
    find_column_for_b(tm);
    if(table[row][column]=='<'){
    valid=1;
    break;
    }
    u++;
  }
  if(!valid){
  printf("\n String is not accepted");
  getch();
  exit(0);
 }
 len=u+1;
  v=len-1;
  for(w=0;w<len;w++){
  handle[w]=term[v];
  v--;
  }
  handle[len]='\0';
  reduce();
 }
  else{
  printf("\n String is not accepted");
  getch();
  exit(0);
  }
}

void check(){
  while(length>(-1)){
  check_for_precedence();
  begin=1;
if(stack[0]=='$'&& stack[1]=='E'&& stack[2]=='\0'&&
  token[0]=='$'&&token[1]=='\0'){
    printf("\n String is accepted");
    getch();
    exit(0);
  }
  if(stack[0]=='$'&& stack[1]=='i'&& stack[2]=='\0'&&
token[0]=='$'&&token[1]=='\0'){
  printf("\n String is accepted");
    getch();
    exit(0);
  }
  if(stack[0]=='$'&& stack[1]!='E'&& stack[2]=='\0'&&
token[0]=='$'&&token[1]=='\0'){
    printf("\n String is not accepted");
    getch();
    exit(0);
  }
  }
 }
 void main(){
  clrscr();
  printf("\n Operator precedence for the parcer\n");
  printf("\n E->EAE|(E)|E|i\n");
  printf("\n A->+|-|*|/|^\n\n Enter the string (add $ to the end of the string):\n");
  scanf("%s",&token);
  i=0;
  length=strlen(token);
  begin=0;
  top=0;
  stack[top]='$';
  if((stack[top]=='$')&&(strcmp(token,"$")==0)){
  printf("\n String is not accepted");
  getch();
  exit(0);
  }
  check();
  getch();
}


Result



Operator precedence for the parser

E --> EAE / (E) / E / i

A --> + / - / * / / / ^

Enter the string ( add $ to the end of the string ): (i*i)$

String is accepted




Friday, 7 July 2017

Kerala University Semester 7 Computer Science, 2013 Sheme


Kerala University Semester 7 Computer Science 2013 Scheme Syllabus

Syllabus Download

1) Computer Graphics
      - Donald Hearn and M. Pauline Baker, Computer Graphics-C Version, 2/e
         DOWNLOAD

Computers have become a powerful tool for the rapid and economical production of pictures. There is virtually no area in which graphical displays cannot be used to some advantage, and so it is not surprising to find the use of computer graphics so widespread. Although early applications in engineering and science had to rely on expensive and cumbersome equipment, advances in computer technology have made interactive computer graphics a practical tool. Today, we find computer graphics used routinely in such diverse areas as science, engineering, medicine, business, industry, government, art, entertainment, advertising, education, and training.A major use of computer graphics is in design processes, particularly for engineering and architectural systems, but almost all products are now computer designed. Generally referred to as CAD, computer-aided design methods are now routinely used in the design of buildings, automobiles, aircraft, watercraft, spacecraft,
computers, textiles, and many, many other products.

2) Embedded Systems
      - Wayne Wolf and Morgan Kaufmann, Computers as Components-Principles of
         Embedded Computer System Design, 2/e
          DOWNLOAD

The traditional microprocessor system design class originated in the 1970s when microprocessors were exotic yet relatively limited.That traditional class emphasizes breadboarding hardware and software to build a complete system. As a result, it concentrates on the characteristics of a particular microprocessor, including its instruction set, bus interface, and so on.This book takes a more abstract approach to embedded systems.  This book is fundamentally not a microprocessor data book. As a result, its approach may seem initially unfamiliar. Rather than concentrating on particulars, the book tries to study more generic examples to come up with more generally applicable principles. However, this approach is both fundamentally easier to teach and in the long run more useful to students. It is easier because one can rely less on complex lab setups and spend more time on pencil-and-paper exercises,simulations, and programming exercises. It is more useful to the students because their eventual work in this area will almost certainly use different components and facilities than those used at your school. Once students learn fundamentals, it is much easier for them to learn the details of new components.


3) Software Engineering And Project Management
     - Roger S. Pressman, Software Engineering, 7/e
         DOWNLOAD

Computer software is the product that software professionals build and then support over the long term. It encompasses programs that execute within a computer of any size and architecture, content that is presented as the computer programs execute, and descriptive information in both hard copy and virtual forms that encompass virtually any electronic media. Software engineering encompasses a process, a collection of methods (practice) and an array of tools that allow professionals to build high quality computer software. Software engineers build and support software, and virtually everyone in the industrialized world uses it either directly or indirectly. Software is important because it affects nearly every aspect of our lives and has become pervasive in our commerce, our culture, and our everyday activities. Software engineering is important because it enables us to build complex systems in a timely manner and with high quality. You build computer software like you build any successful product, by applying an agile, adaptable process that leads to a high-quality result that meets the needs of the people who will use the product. You apply a software engineering approach.
From the point of view of a software engineer, the work product is the set of programs, content (data), and other work products that are computer software. But from the user’s viewpoint, the work product is the resultant information that somehow makes the user’s world better.

4) Fuzzy Set Theoy And Applications
     - Timothy J. Ross, Fuzzy Logic with Engineering Applications, 2/e
         DOWNLOAD

Our understanding of most physical processes is based largely on imprecise human reasoning. This imprecision (when compared to the precise quantities required by computers) is nonetheless a form of information that can be quite useful to humans. The ability to embed such reasoning in hitherto intractable and complex problems is the criterion by which the efficacy of fuzzy logic is judged. Undoubtedly this ability cannot solve problems that require precision – problems such as shooting precision laser beams over tens of kilometers in space; milling machine components to accuracies of parts per billion; or focusing a microscopic electron beam on a specimen the size of a nanometer. The impact of fuzzy logic in these areas might be years away, if ever. But not many human problems require such precision – problems such as parking a car, backing up a trailer, navigating a car among others on a freeway, washing clothes, controlling traffic at intersections, judging beauty contestants, and a preliminary understanding of a complex system.

SUNDAY HOLIDAY - MALAYALAM MOVIE



Sunday Holiday is an upcoming malayalam movie. Asif Ali and Aparna Balamurali are the lead characters in the film. Jis Joy is the director and Sheen Helen is the producer of the film. Songs are composed by Deepak Dev. The song "mazha paadum..." has already become trending in the youtube. The song "mazha paadum ..." was sung by Aravind Venugopal (son of playback singer G Venugopal) and Aparna Balamurali(actress). Production Co : Maqtro pictures . Asif Ali's upcoming movies are Avarude Ravukal (starred by Mukesh, Honey Rose, Vinay Forrt, Aju Varghese), Kumarasambhavam Live( directed by Shaiju Anthikkad), Town To Town( female lead role by Gauthami Nair) , Goodbye December, St.Peter's Day( starred by Sunny Wayne, Aju Varghese, Joju George, Manoj K Jayan), Happy Birthday ( female lead role by Janani Iyer), Omanakuttante Sahasangal ( female lead role by Bhavana), Beautiful Game, Thrissivaperoor Kliptham(starred by Aparna Balamurali, Chemban Vinod, Joju George). The film Avarude Ravukal is scheduled to release on August 14, 2017.
Asif Ali's most of the recently released movies were not successful in the box office, he also produced a couple of films which couldn't recieve  positive response from the audience. Audience are eagerly waiting for his mass comeback in the mollywood, can wait and see...



Saturday, 18 March 2017

8086 PROGRAM TO SORT 'N' NUMBERS IN ASCENDING ORDER( INPUT AND OUTPUT SPECIFICATION )

SORTING 8086 PROGRAM

AIM : 8086 PROGRAM TO SORT 'N' NUMBERS IN ASCENDING ORDER

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV BL,[1300] MOVE COUNT IN BL REGISTER
1004 DEC BL DECREMENT BL
1006 L1 MOV CL,BL MOVE COUNT TO CL
1008 MOV DI,1301 LOAD DI WITH MEMORY LOCATION
100C MOV SI,1302 LOAD SI WITH MEMORY LOCATION
1010 L2 MOV AL,[DI] MOVE CONTENT OF DI TO AL
1012 MOV DL,[SI] MOVE CONTENT OF SI TO DL
1014 CMP AL,DL COMPARE AL WITH DL
1016 JBE L3 JUMP TO L3 IF BELOW OR EQUAL
1018 MOV [DI],DL MOVE CONTENT OF DL TO DI
101A MOV [SI],AL MOVE CONTENT OF AL TO SI
101C L3 INC SI INCREMENT SI
101D INC DI INCREMENT DI
101F DEC CL DECREMENT CL
1020 JNZ L2 JUMP TO L2 IF NOT EQUAL TO ZERO
1022 DEC BL DECREMENT BL
1024 JNZ L1 JUMP TO L1 IF NOT EQUAL TO ZERO
1026 HLT STOP


INPUT                                          OUTPUT

[1300] : 05                                    [1300] : 00
[1301] : 00                                    [1301] : 01
[1302] : 06                                    [1302] : 03
[1303] : 01                                    [1303] : 05
[1304] : 03                                    [1304] : 06


RESULT

8086 PROGRAM TO SORT 'N' NUMBERS IN ASCENDING ORDER HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED.

8086 Program to check whether a given number is prime or not( input and output specification )

                                 PRIME NUMBER CHECKING 8086 PROGRAM

AIM : TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT (8086 PROGRAM)

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV BX,0002 MOVE 0002 INTO BX
1004 MOV MOV AX,[1300] MOVE THE CONTENT OF 1300 TO AX
1008 MOV DX,0001 MOVE 0001 INTO DX
100C CMP AX,0002 COMPARE AX WITH 2
1010 JZ L2 JUMP TO L2 IF ZERO
1012 L1 MOV DX,0000 INITIALIZE DX WITH ZERO
1016 DIV BX DIVIDE AX WITH BX
1018 CMP DX,0000 COMPARE DX WITH 0000
101C JZ L3 JUMP TO L3 IF ZERO
101E MOV AX,[1300] MOVE CONTENT OF 1300 TO AX
1022 INC BX INCREMENT BX
1023 CMP AX,BX COMPARE AX WITH BX
1025 JNZ L1 JUMP TO L1 IF NOT ZERO
1027 L2 MOV [1302],0001 MOVE 0001 TO 1302
102C L3 MOV [1302],DX MOVE DX TO 1302
1030 HLT STOP


INPUT                                                      OUTPUT

[1300] : 0004                                            [1302] : 0000
[1300] : 0005                                            [1302] : 0001


RESULT

8086 PROGRAM TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED.


8086 Program to find the factorial of a number( input and output specification)

                                                 FACTORIAL OF A NUMBER 

AIM : To find the factorial of a number

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV SI,2000 MOVE 2000 INTO SI
1004 MOV BX,[SI] MOVE THE CONTENT OF SI TO BX
1006 MOV AX,01 MOVE 0001 INTO AX
100A L1 MUL BX MULTIPLY AX WITH BX/td>
100C DEC BX DECREMENT BX
100D JNZ L1 JUMP IF NON-ZERO TO LABEL1
100F MOV DI,2002 MOVE 2002 INTO DI
1013 MOV [DI],AX MOVE CONTNT OF AX INTO LOCN SPCIFED IN DI
1015 HLT STOP


INPUT :                                      OUTPUT :

[2000] : 0004                          [2002] : 0018 // 0018 is the hexadecimal value of 24

8086 Program to check whether the given number is odd or even( input and output specification)

SORTING 8086 PROGRAM

AIM : 8086 PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS ODD OR EVEN

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV AX,[3000] Move the content of 3000 to AX
1004 MOV BX,0002 Move 0002 into BX
1008 DIV BX Divide AX with BX
100C CMP DX,0000 Compare DX with 0000
100E JZ L1 Jump if zero
1010 MOV DX,0001 Move 0001 into DX
1014 L1 MOV [3002],DX Move content of DX to 3002
1018 HLT Stop


INPUT                                          OUTPUT

[3000] : 0005                                    [3002] : 0001                          // If the input given is odd, '1' will get stored at location 3000 else '0'



Input is given as, SW 3000
Then give the input value, 0005
Then execute the program, GO 1000  //1000 is starting address of the program.
Press  INT button on the kit.
Now the output is stored at location 3002, to view the output, SW 3002


RESULT

8086 PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS ODD OR EVEN HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED