Thursday, April 12, 2012

OOAD Questions Unit 4

Object Oriented Analysis and Design - Ali Bahrami. unit 4 Questions
Unit 4 Question

OOAD Questions Unit 3

Object Oriented Analysis and Design - Ali Bahrami. Unit 3 Questions

Unit 3 Question

OOAD Questions Unit 2

Object Oriented Analysis and Design - Ali Bahrami. Unit 2 Questions
Unit 2 Ooad Question

OOAD Questions Unit 1

Object Oriented Analysis and Design - Ali Bahrami. Unit 1 Questions.
Unit -1 OOAD Question

OOAD Question Bank

Object Oriented Analysis and Design - Ali Bahrami. All five Units Question bank. 2 Marks and 10 marks.

OOAD Question Bank

OOAD Complete Notes all Units

Complete Notes for all chapters in Object Oriented Analysis and Design - Ali Bahrami
Ooad Complete Notes

OOAD 2 Mark Questions with Answers

Object Oriented Analysis and Design - Ali Bahrami. Two Marks from all five units with Answers.


Ooad 2 Marks Notes

Multi Threading

Multi threading, Thread Life Cycle, Daemon thread, Difference between application and applet, Types of applet, applet life cycle of JAVA PROGRAMMING. Notes by Akila Mam.

Multi Threading - Java

OOAD Important Questions

Object Oriented Analysis and Design - Ali Bahrami. All five units - Important Questions.

IMP OOAD

Event Classes in Java

Notes given by Akila Mam
Event Classes in Java

8 Package and Interface


import a.*;

interface Area
 {
   float compute(float x, float y);
 }

class Rectangle implements Area
 {
   public float compute(float x, float y)
    {
return(x * y);
    }
 }

class Triangle implements Area
 {
   public float compute(float x,float y)
    {
return(x * y/2);
    }
 }

class InterfaceArea
 {
   public static void main(String args[])
    {
Rectangle rect = new Rectangle();
Triangle tri = new Triangle();
Area area;
area = rect;
System.out.println("Area Of Rectangle = "+ area.compute(1,2));
area = tri;
System.out.println("Area Of Triangle = "+ area.compute(10,2));
    }
 }

Upper to Lower Case


echo "program to convert uppercase to lower case"
echo "enter the filename to be created:"
read str
vi $str
echo "1.lowercase to uppercase"
echo "2.uppercase to lowercase"
echo "select your choice:"
read ch
case $ch in
1)cat $str | tr "{a-z}" "{A-Z}" | tee $str cat $str;;
2)cat $str | tr "{A-Z}" "{a-z}" | tee $str cat $str;;
*)echo "invalid choice"
esac

Unlink


clear
echo
ch=0
while [ $ch_lt 2 ]
do
echo "1.create file
      2.unlink"
echo
echo "enter your choice:"
read ch
echo $ch
case $ch in
1)echo "enter file name:"
read fn
vi $fn;;
2)unlink $fn;
esac
done

System Calls


clear
echo "program to show file commands"
con='Y'
while [ $con='Y' ]
do
echo "1.list of files and folders
2.user's
3.process running currently
4.today's date
5.calender
6.quit"
echo "enter your choice:"
read choice
case $choice in
1)ls;;
2)who;;
3)ps;;
4)date;;
5)cal;;
6)exit;;
*)echo "invalid choice"
esac
echo
echo "Do you want to continue(y/n)"
read con
if [ $con='n' ]
then
exit;
echo "continue"
fi
done

Sorting and Unsorting a File


clear
echo
ch=0
while [ $ch -lt 6 ]
do
echo
echo "1.create a file
     2.sort a file
     3.sorted file
     4.unsorted file
     5.clear
     6.quit    "
echo
echo "Enter your choice:"
read ch
echo $ch
case $ch in
1) echo "Enter file name"
read fn
vi $fn;;
2) echo "sorted process is over";;
3) sort $fn;;
4) cat $fn;;
5) clear;;
6) exit;;
esac
done

Signalling


#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
void signal_callback_handler(int signum)
{
printf("caught signal%d \n",signum);
exit(signum);
}
int main()
{
signal(SIGINT,signal_callback_handler);
while(1)
{
printf("program processing stuff here \n");
sleep(1);
}
return EXIT_SUCCESS;
}

Semaphores


#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/sem.h>
#include<stdio.h>
#define KEY (1492)
void main()
{
int id;
union semun
{
int val;
struct semid_ds *buf;
ushort * array;
}
argument;
argument.val=0;
id=semget(KEY,1,0666 | IPC_CREAT);
if (id<0)
{
fprintf(stderr,"unable to obtain semaphore.\n");
}
if(semctl(id,0,SETVAL,argument)<0)
{
fprintf(stderr,"cannot set semaphore value.\n");
}
else
{
fprintf(stderr,"semaphore %d initialized.\n",KEY);
}
}


PipeLining


#include<sys/types.h>
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
void
read_from_pipe(int file)
{
 FILE *stream;
 int c;
 stream=fdopen(file,"r");
 while((c=fgetc(stream))!=EOF)
 putchar(c);
 fclose(stream);
}

void
write_to_pipe(int file)
{
 FILE *stream;
 stream=fdopen(file,"w");
 fprintf(stream,"Hello,world!\n");
 fprintf(stream,"Gud bye,world!\n");
 fclose(stream);
}

int main (void)
{
 pid_t pid;
 int mypipe[2];
 if (pipe(mypipe))
 {
  fprintf(stderr,"pipe failed \n");
  return EXIT_FAILURE;
 }
 pid=fork();
 if(pid==(pid_t)0)
 {
  close(mypipe[1]);
  read_from_pipe(mypipe[0]);
  return EXIT_SUCCESS;
 }
 else if (pid<(pid_t)0)
 {
  fprintf(stderr,"forkfailed \n");
  return EXIT_FAILURE;
 }
 else
 {
  close(mypipe[0]);
  write_to_pipe(mypipe[1]);
  return EXIT_SUCCESS;
 }
}

Mark Statement


clear
echo "enter stud's name:"
read name
echo "enter roll no:"
read roll
echo "enter mark in p1:"
read m1
echo "enter mark in p2:"
read m2
echo "enter mark in p3:"
read m3
echo "enter mark in p4:"
read m4
echo "enter mark in p5:"
read m5
echo "enter mark in p6:"
read m6
clear
echo "......."
echo "result"
echo "......."
echo "name:$name"
echo
echo "roll no:$roll"
echo
echo "M.Tech"
echo
echo "p1:$m1"
echo
echo "p2:$m2"
echo
echo "p3:$m3"
echo
echo "p4:$m4"
echo
echo "p5:$m5"
echo
echo "p6:$m6"
echo
echo "Total:`expr $m1 + $m2 + $m3 + $m4 + $m5 + $m6`"
echo
echo "Average:`expr $m1 / 6 + $m2 / 6 + $m3 / 6 + $m4 / 6 + $m5 / 6 + $m6 / 6`%"
echo
if [ $m1 -gt 50 -a $m2 -gt 50 -a $m3 -gt 50 -a $m4 -gt 50 -a $m5 -gt 50 -a $m6 -gt 50 ]
then
echo "Pass"
else
echo "Fail"
fi
echo
echo "......"

Insert and Search


clear
echo "Enter your file name:"
read fn
search=` find $fn `
if [ $fn = $search ]
then
echo "Enter your word to be searched:"
read se
word=`fgrep -a -o -m 1 $se $fn`
if [ $se = $word ]
then
choice=`zenity --list \
--title="search result" \
--column= " "\
"sucess-found the specified word"`
else
choice=`zenity --list \
--title="search result" \
--column=" "\
"failed-specified word not found"`
fi
else
choice=`zenity --list \
--title="error" \
--column=" "\
"failed-file not found"`
fi

Fork Child


#include <stdio.h>
int main(void)
{
 int pid;
 pid=fork();
if(pid==0)
 {
   int j;
  for(j=0;j<10;j++)
  {
   printf("child:=%d\n",j);
   sleep(1);
  }
  exit(0);
}
  else if(pid>0)
 {
 int i;
 for(i=0;i<10;i++)
 {
  printf("parent:%d\n",i);
  sleep(1);
 }
 }
 else
 {
  fprintf(stderr,"couldn't fork");
  exit(1);
 }
}

Fan of Process


#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
int main()
{
int i;
int n=10;
pid_t childpid;
for(i=1;i<n;++i)
if((childpid=fork())<=0)
break;
fprintf(stderr,"this is process %ld with parent %ld\n",(long)getpid(),(long)getpid());
}

Error Checking


#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
const char *FILE_NAME="File.c";
int main ( int argc, char ** argv )
{
int fd=0;
printf ("FINDING %s...\n",FILE_NAME);
fd = open (FILE_NAME,O_RDONLY,0644);
if
(fd<0)
{
perror("Error opening file");
printf("Error opening file:%s\n",strerror( errno ) );
}
else
{
printf("\n File Present");
}
return EXIT_SUCCESS;
}

Error Handling


#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int divident = 50;
int divisor = 0;
int quotient;
if (divisor == 0)
 {
 fprintf (stderr,"Division by zero ! aborting.....\n");
 exit(EXIT_FAILURE);
 }
else
 {
 quotient=divident /divisor ;
 exit (EXIT_SUCCESS);
 }
}

Chain of Process


#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
int main()
{
  int i;
  int n=10;

  pid_t childpid;

  for(i=1;i<n;++i)
   if(childpid=fork())
   break;

 printf("this is process %ld with parent %ld\n",(long)getpid(),(long)getppid());

}

Computer architecture Q . Paper {MCA}


*Please download and rotate the second image

Just practice these questions for the exams.
Hope U find this useful.

Unit 5 - Input Output Organization

This post contains the notes for the fifth unit - INPUT OUTPUT ORGANIZATION of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points and Diagrams too. U can view and download it from here itself


(If there is any errors in it, please notify me in form of comments)

Unit 4 - Memory Management

This post contains the notes for the fourth unit - MEMORY MANAGEMENT of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points and Diagrams too. U can view and download it from here itself


(If there is any errors in it, please notify me in form of comments)

Unit 3 - Basic Processing unit

This post contains the notes for the third unit - Basic Processing Unit of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points and Diagrams too. U can view and download it from here itself


(If there is any errors in it, please notify me in form of comments)

Unit 3 - Basic Processing unit

This post contains the notes for the third unit - Basic Processing Unit of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points and Diagrams too. U can view and download it from here itself


(If there is any errors in it, please notify me in form of comments)

Unit 2 - Arithmetics

This post contains the notes for the Second unit - ARITHMETICS of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points and Diagrams too. U can view and download it from here itself


(If there is any errors in it, please notify me in form of comments)

Unit 1 - Basic Structures of Computers

This post contains the notes for the first unit - BASICS STRUCTURES OF COMPUTER of our COMPUTER ORGANIZATION AND ARCHITECTURE. If strictly follows the cook by Carl Hamacher and I have added some important points too. U can view and download it from here itself



(If there is any errors in it, please notify me in form of comments)