CS2311 OOPS - Monthly Test Question Paper (Unit 3 and 4)

0
Anna University

Department of Computer Science Engineering


Semester : V

Department : B.E EEE

Year : III

Subject Code : CS2311

Subject Name : OOPS

Part A

1.What is Exception and what are its types?
2.what is Namespace.
3.Write the syntax for function templates.
4.What are the features of Java.
5.What is JVM?
6.What is By Bytecode ?
7.Write the syntax for creating object in Java.
8.Write the Structure of Java Program.
9.What is class?
10.What is Pakage ?

Part B

11.a)Expalin Read , Write function.
or
11. b) Explain fstream,ofstream and ifstream.

12. a) Explain Multiple file.

13. a) Explain the example for adding method and variable in JAVA program.

or

b) Explain Pakage Program.
Answer :
Code:
Package program

package skec;

public class eee

{

public void print()

{

System.out.println("eee dept");

}}



package skec;

public class it

{

public void print1()

{

System.out.println("welcome to it dept");

}}



import skec.*;

class student

{

public static void main(String args[])

{

eee e=new eee();

it i=new it();

e.print();

i.print1();

}

}


14. a) Explain how to Create and Execute Java Program.
or
b) Explain array and its Types.

15. a) Write a Java program to print the 3 digit individual no.
Answer :
Code:
Print the 3 digit individual no.

import java.io.*;

class selva

{

public static void main(String args[])

{try{

int a=0,b=0;

DataInputStream din=new DataInputStream(System.in);

System.out.println("Enter the three digit no");

a=Integer.parseInt(din.readLine());

while(a>0)

{

b=a;

System.out.println(b);

a=a/10;

}}catch(IOException e)

{}}}
or

b) Write a Java program to biggest of 3 numbers.
Answer :
Code:
import java.io.*;

class student

{

try{

int a,b,c;

DataInputStream din=new DataInputStream(System.in);

a=Integer.parseInt(din.readLine());

b=Integer.parseInt(din.readLine());

c=Integer.parseInt(din.readLine());

if(a>b)

{

                if(a>c)

                {

                System.out.println(a);

                }

                else

                {

                System.out.println(c);

                }

}

else

{

                if(b>c)

                {

                System.out.println(b);

                }

                else

                {

                System.out.println(c);

                }

}}

catch(IOException e)

{}

}}

New Share your Study Materials with us : Click Here