Featured

    Featured Posts

MDU B.Tech First year Sample Papers All Semesters Papers Free download


MDU B.E/B.Tech Sample Papers in PDF Download Here

Download free sample papers of MDU B.E/B.Tech 1st year common semester solved papers.  All the previous solved sample papers can be downloaded from here with the links provided.

1. Essentials Of Communication 1st Semester Solved Sample Paper.
2. Fundamentals Of Computer Programming Solved Sample Papers.
3. Manufacturing Process Solved Sample Papers.
4. Engineering Physics I Solved Sample Papers
5. Engineering Mathematics 1 Solved Sample Papers.
6. Engineering Chemistry Solved Sample Papers.


MDU BE/B.Tech 2nd Semester Solved Sample Papers.  Previous Year MDU BE/B.Tech Solved Sample Papers.  Shortcut to prepare for your semester exams.
  1. Engineering Physics 2 Solved Sample Paper.
  2. Engineering Mathematics 2nd Solved Sample Paper.
  3. Communication Skills in English Solved Sample Paper.
  4. Elements Of Mechanical Engineering Solved Sample Paper.
  5. Electrical Technology Solved Sample Papers.
  6. Basics Of Electronics Solved Sample Papers.

MDU B.E/B.Tech Previous Year Solved Sample Papers

 

MDU B.Tech Sample Papers, Download All Year MDU B.Tech Previous Year Solved Question Papers

  Here you will find all the previous years solved sample papers.  We will keep posting the latest papers timely.  So keep in touch with us guys for more updates.


MDU B.E/B.Tech Sample Papers for All Branches and All Semesters

1. First Year Common Subjects Sample Papers
2. Information Technology.
3. Computer Sc. and Engineering.
4. Mechanical Engineering.
5. Electronics & Communication Engineering.
6. Electrical Engineering.
7. Electronics & Electrical Engineering.


Procedure Oriented Programming.

Procedure Oriented Programming :-

      Procedure oriented programming basically consists writing a lists of instructions  for the computer to follow and organizing these instructions into groups known as functions.
     In a multi-function program, many important data items are placed as global, so that they may be accessed by all the functions.  Each functions may have its own data.




Fig. Relationship of data and functions in procedural programming

   Some of the procedure oriented language are C, COBOL and PASCAL.

      Procedure oriented languages is a conventional programming using high level language such as COBOL, FORTRAN AND C is commonly known as procedural language.

     Languages that uses procedure-oriented approach are called procedure oriented languages.
In procedure-oriented approach the problem is viewed as a sequence of things to be done, such as reading, calculating and printing. 

* A number of functions are written to accomplish these tasks.  The primary focus is on functions.

A typical program structure for procedural program is shown in figure.



# Characteristics of procedure-oriented language programming :->

1.  Emphasis is on doing things ( Algorithms ).
2.  Large programs are divided into smaller programs known as functions.
3.  Most of the functions share global data.
4.  Data move openly round the system from function to function.
5.  Functions transforms data from one form to another.
6.  Employs top-down approach in program design.

# Drawbacks of procedure-oriented approach:->

1.  It doesn't model real world problems very well.  This is because the functions are action-oriented and do not really correspond to elements of the problem.
2.  Global data are more vulnerable to an inadvertent change by a function.  In a large program it is very difficult to identify what data used by which functions.


MDU SAMPLE PAPERS

 

You can use your mobile device for studying because this will work in mobile applications too.


ADVANCE JAVA May-2009 Paper Code : CSE-404-E

MDU ADVANCE JAVA Dec 2009 CSE-404-F

Basics of Mechanical Engineering (ME-101F)






ADVANCE JAVA

 

 

ADVANCE JAVA

May 2009

Paper Code : CSE-404-E

Q.1. Explain the concept  of arrays in java with suitable program.  Also explain the inheritance and exception handling with examples.

Ans. Arrays :  An Arrays is a (fixed length) data structures used to store multiple data elements of same type.  The memory allocated to an array is consecutive. All the elements of an array are under one variable name.  Every data element of an array is accessed by its position and that position in indicated by an integer value that start from 0 called index.  The array size is fixed and cannot be changed at runtime of the program.
Java supports two types of arrays:
(i) One Dimensional Array.
(ii) Multiple Dimensional Array.

In Java, arrays can be of either types, primitive data types or reference types.  In primitive data type array, all elements are of a definite primitive data type.  In references type array all elements are of definite reference type.
Declaration of Array Variables : The syntax to declare either type of arrays , i.e. one -dimensional or multiple dimensional array is :
<data.type>[]  <array - name>;                 //One Dimensional Array
Or
<data.type>  <array - name>[];               //One Dimensional Array
Syntax to create an array:
<array - name> = new <data-type> [<array-size>];                //One dimensional Array

Initialization of Array : Initialization means to assign the value to the array at the time of constructing and declaring in one statement simultaneously.
<data - type> [] <array - name> = { <initial value list>};
For example :
int an_Array = {1,2,3,4,5,6,7,8,9 };                //One dimensional Array
for(int i=0;i<3;i++)
System.out.println(anArray[i]);      //Accessing ith index Value.
int matrix[] [] = {{1,2,3},{4,5,6,},{7,8,9}};      //Two dimensional Array
for (int i=0; i<3; i++)
{ for (int j=0; j=3; j++)
         System.out.print(matrix[i][j]);
System.out.println();
}

Inheritance : Inheritance is one of the most important and useful feature of object-oriented programming.  There is a main class, called base class or super class, from which a new class id derived, called derived class or sub class.  Base class is also called parent class and the derived class is called child class.  Inheritance provides a mechanism for deriving new classes from existing ones.  In OOP, ther are several type of mechanisms:
(1) Single Inheritance
(2) Multiple Inheritance
(3) Multilevel Inheritance
(4) Hybrid Inheritance

In Java a class can be derived from another class using the general form :
access_specifier class Subclass extends Superclass
{ //Derived class data and methods
}
Example:
class A {
int x;
int y;
int get(int p, int q) {
x = p; y = q; return(0);
}
void show() {
System.out.println(x);
}
}
class B extends A {
void showb() {
System.out.println("B");
}
}
class c extends B {
void display() {
System.out.println("C");
}
}
public static void main(strings args[]) {
A a = new A();
a.get(5,6);
a.show();
}
}
Exception Handling : An exception is a run-time error or an anomalous condition that arises in the program during run time. A Java exception is an object that describes an abnormal condition in the program code.  When an abnormal condition is encountered in the object code, an object representing that condition or exception is created an thrown in the method that caused the error.  The method can then make the choice to handle the exception itself or pass it on.  An exception may also be caught and processed.  Exception can also be manually generated by your program code. Exceptions thrown by Java programs are actually the errors that violate the constraints of Java runtime.  In Java, exception handling
- try
- catch
- throw
- throws
- finally
The program statements to be monitored for exceptions are kept within a 'try block'.  If an exception occurs in the 'try block', then it is thrown.  The statements that have to be thrown manually are kept in the 'catch block'.  System generated exceptions are automatically thrown by Java runtime environment.  The general form of exception handling is :
try
{      //block of code to be monitored
}
catch (Exception_TypeA obj)
{     //exception handler for Exception_TypeA
}
Finally
{       //block of code to be executed
}
All types of exceptions are the subclass of built-in class Throwable. Throwable contains two subclasses, one is exception for the abnormal conditions that the user programs must handle.  Exceptions include conditions like divide by zero.  This type of exception is called Arithmatic Exception.  Another subclass is error that contains the conditions that are not expected to be caught under normal conditions.
Example:
class Multiple_Catch
{
Public static void main(String args[])
{
try
{
int x=0;
int y=y/x;
int a[] = {6};
a[89] = 44;
}
catch (Arithmetic Exception e1)
{
System.out.println("ERROR : Divide by Zero" +e1);
}
catch (Array Index Of Bound Exception e2)
{
System.out.println("ERROR : Array out of Bound" +e2);
}
}
}

Q.2. Explain the concept of E-Mail server.

Ans. E-Mail server : A socket will be created, connect to port 25, which is SMTP port number.  Simple mail transfer Protocol describes the format in which e-mail message will be sent.  In UNIX OS, sendmail daemon was already implemented to support this features.

Example :
import Java.io.BufferedReader;
import Java.io.FileReader;
import Java.io.IOException;
import Java.io.InputStream;
import Java.io.InputStreamReader;
import Java.io.OutputStream;
import Java.io.OutputStreamWriter;
import Java.io.PrintWriter;
import Java.net.InetAddress;
import Java.net.Socket;
import Java.net.UnknownHostException;
public class SMTPDemo  {
public static void main (String args[] throws IOException, UnknownHostException  {
String msgFile = "file.txt";
String from = "java2s@java2s.com";
String to = "yourEmail@yourServer.com";
String mailHost = "yourHost";
SMTP mail = new SMTP(mailHost);
if(mail != null) {
if (mail.send(new FileReader (msgFile), from, to))    {
System.out.println("Mail sent.");
} else  {
System.out.println("Connect to SMTP sever failed !");
}
}
System.out.pritnln("Done");
}
static class SMTP   {
private final static int SMTP_PORT = 25;
Inetdderess mailHost;
Inetddress localHost;
BufferedReader in;
Public SMTP (String host) throws UnknownHostException  {
mailHost = InetAddress.getByName (host);
localHost = InetAddress.getLocalHost ( );
System.out.println("mailhost = "+ mailHost );
System.out.println("localhost = "+ localHost);
System.out.println("SMTP construtor done\n");
}
public boolean send (FileReader msgFileReader, String from, String to ) throws IOException   {
Socket smtpPipe;
InputStream inn;
OutputStream outt;
BufferedReader msg;
msg = new BufferedReader(msgFileReader);
smtpPipe = new Socket(mailHost, SMTP_PORT);
if (smtpPipe == null)  {
return false; }
inn = smtpPipe.getInputStream( );
outt = smtpPipe.getOutputStream( );
in = new BufferedReader(new InputStreamReader(inn));
out = new PrintWriter(new OutputStreamWriter(outt), true);
if (inn = = null \\ out= = null) {
System.out.println("Failed to open streams to socket.");
return false;
}
StringinitialID = in.read.Line( );
System,out.println(initialID);
System.out.println("HELO " + localhost.getHostName( ));
out.println("HELO " + localhost.getHostName( ));
String welcome = in.readLine ( );
System.out.println(welcome);
System.out.println("MAIL From:<" + from + ">");
out.println("MAIL From:<" + from + ">");
String senderOK = in.readLine( );
System.out.println(senderOK);
System,out.println("RCPT TO:<" + to + ">");
out.println("RCPT TO:<" + to + ">");
String RecipientOK = in.readLine( );
System.out.println(recipientOK);
System.out.println("DATA");
out.println("DATA");
String line;
While((line = msg.readLine ( )) != null )  {
out.println(line);
}
System.out.println(".");
out.println(".");
String acceptedOK = in.readLine( );
System.out.println(acceptedOK);
System.out.println("QUIT");
out.println("QUIT");
return true;
     }
   }
}

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.
Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com