MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
|
|
- Amice Francis
- 6 years ago
- Views:
Transcription
1 Page 1 of 18 Q1. A. Attempt any three of the following. a. (Half mark for each data type and its size) Type Size byte One byte short Two bytes int Four bytes long Eight bytes float Four Bytes double Eight Bytes char Two bytes boolean One bit b. (Definition of Thread 1 mark, Thread Priority 3 marks) A thread is a program that has single flow of control. It has a beginning, a body and an end and executes commands sequentially. Thread Priority A thread can be assigned a priority, which affects the order in which it is scheduled for running. Thread with same priority are given equal treatment by the Java scheduler and hence they share the processor on a first come first serve basis. The priority of a thread can be set using setpriority(() method as follows ThreadName.setpriority(intNumber); The Thread class defines priority constants MIN_PRIORITY = 1 NORM_PRIORITY = 5 MAX_PRIORITY = 10 In a multithreading system, the Java system chooses the highest priority thread and executes it. The highest priority thread always preempts the lower priority threads. c. (1 mark for each point, minimum 4 points) To be truly considered "object oriented", a programming language should support at a minimum four characteristics. Java supports all of these features. Objects and Classes Objects are the basic run-time entities. The entire set of data and the code of an object are defined in a class. Data Abstraction and Encapsulation wrapping up of data and methods in a single unit called class. Polymorphism--the same message sent to different objects results in behavior that's dependent on the nature of the object receiving the message Inheritance It is the process by which objects of one class acquire the properties of objects of another class.
2 Page 2 of 18 Dynamic binding The code associated with a given procedure call is not known until the time of the call at run time. Message Communication A message for an object is a request for execution of a procedure, and therefore will invoke a method in the receiving object that generates the desired result. d. Built in Packages from Java API (1 mark for each package and its use, Any four) Sr. No. Package Name Use 1. Java.lang Language support classes 2. Java.util Language utility classes 3. Java.io Input/Output support classes 4. Java.awt Set of classes for implementing graphical user interface 5. Java.net Classes for networking 6. Java.applet Classes for creating and implementing applets Q1 (B) a. Wrapper Classes (3 marks for wrapper classes, 3 marks for methods) 1. Wrapper Classes for converting simple types 2. Converting Primitive Numbers to Object Numbers using Constructor methods 3. Converting Object Numbers to Primitive Numbers using typevalue() method 4. Converting Numbers to strings using tostring() method. 5. Converting String Objects to Numeric Objects using static method valueof() 6. Converting Numeric Strings to Primitive Numbers using parsing methods Methods of Integer wrapper class (Any four) 1. Int compareto(int i) 2. Boolean equals(object i) 3. String tostring() 4. static Integer valueof(string str) throws NumberFormatException 5. static Int parseinteger(string str) throws NumberFormatException 6. static Strinf tostring(int num) 7. static String tobinarystring(int num) 8. static String tohexstring(int num) 9. static String tooctalstring(int num) b. (logic 2 marks, Syntax 2 marks, Result 2 marks) (Any other suitable program based on the same concept can also be considered.) class percentage public static void main(string args[]) int sub1 = 90; int sub2 = 95; int sub3 = 79;
3 int sub4= 90; double total = sub1+ sub2 + sub3 + sub4; double per = ( total)/4; System.out.println("Percentage = "+per); Q.2 Page 3 of 18 a. (4 marks for overloading, 4 marks for overriding) Sr. No. overloading overriding 1. It happens within the same class It happens between super class and subclass 2. Method signature should not be same Method signature should be same. 3. Method can have any return type Method return type should be same as super class method 4. Method can have any access level Method must have same or wide access level than super class method access level 5. Overloading is early binding or static binding 6. They have the same name but, have different parameter lists, and can have different return types. Overriding is late binding or dynamic binding They have the same name as a superclass method. They have the same parameter list as a superclass method. They have the same return type as a superclass method 7. It is resolved at compile time It is resolved at runtime. 8. For e.g. Simple program showing overloading For e.g. Simple program showing overriding b. (2 mark for Exception, 2 mark for handling exceptions, 4 marks for any four exceptions) Exception is a condition that is caused by a run-time error in the program. When Java interpreter encounters an error, it creates an exception object and throws it. Why handle exceptions? If the exception object is not caught and handled properly, the interpreter displays an error message and will terminate the program. If the execution of the remaining code is to continue, then exception must be caught and handled properly.
4 List of exceptions 1. ArithmeticException 2. ArrayIndexOutOfBoundsException 3. ArrayStoreException 4. FileNotFoundException 5. IOException 6. NullPointerException 7. NumberFormatException 8. OutOfMemoryException 9. SecurityException 10. StackOverFlowException 11. StringIndexOutOfBoundsException Page 4 of 18 c. (Logic 3 marks, Syntax 3 marks, Design 2 marks ) (Any other suitable program based on the same concept can also be considered.) class thread1 extends Thread public void run() for (int i = 1; i <= 10; i++) System.out.println("Thread 1 = "+i); class thread2 extends Thread public void run() for (int j = 10; j >= 1; j--) System.out.println("Thread 2 = "+j); class ThreadTest public static void main(string args[]) new thread1().start(); new thread2().start();
5 Q.3 Page 5 of 18 1 M <- 1 M <- 1 M <- 1 M <- Q.3 (a) Any four features of JAVA 1. Compile & Interpreted JAVA is a two stage system. It combines both approaches. First java compiler translates source code into byte code instruction. Byte codes are not machine instructions. In the second stage java interpreter generates machine code that can be directly executed by machine machine. Thus, java is both compile & interpreted language. 2. Platform independent & portable Java programs are portable i.e. it can be easily moved from one computer system to another. changes in OS, processor, system resources won t force any change in java programs. Java compiler generates byte code instructions that can be implemented on any machine as well as the size of primitive data type is machine independent. 3. Object oriented Almost everything in java is in form of object. All program codes & data reside within objects & classes Similar to other oop language java also have basic oop properties such as encapsulation, polymorphism, data abstraction, inheritance etc. Java comes with an extensive set of classes in packages. 4. Multithreaded It can handle multiple tasks simultaneously. Java makes this possible with the feature of multithreading. This means that we need not wait for the application to finish one task before beginning other. (Any other valid feature can be considered, for each feature, 1 mark) (b) Bytecode (Explanation 4 marks) To solve security & portability problems output of java compiler is not executable code. Java compiler produces intermediate code known as bytecode, for a machine that does not exit. This machine is called as Java Virtual Machine & it only exist inside the computer memory.
6 Page 6 of 18 Bytecode is a highly optimized set of instructions designed to be executed by the java run-time system which is called the JVM (Java Virtual Machine). JVM is an interpreter for the bytecode. The virtual machine code generated by java interpreter. By translating java program into bytecode makes it easier to run the program on a variety of environment thus JVM provides the most convenient way of making portable program. The bytecode requires the JVM for execution it makes the secure. Q.3 (c) Define Interface ( 2 marks) Java does not support multiple Inheritance i.e. classes in java con not have more than one super classes. eg. class A extends B extends C//multiple Inheritance is not supported Java provides an alternate approach known as interface to support concept of multiple inheritance. An interface is basically a kind of class. It can define only abstract method & final fields/data members. The datafields contain constant value. Structure of Interface (2 M) access interface Interfacename returntype method-name1(parameter list); returntype method-name2(parameter list); type final-variable1=value1; type final-variable2=value2; returntype method-name n(parameter list); type final-variable n=value n; where, access is either public or not used interface is the keyword Interface name is the valid java identifier Q. 3 (d) (Package and its creation 2 marks, example 2 marks) Java provides a mechanism for partitioning the class name space into more manageable parts. This mechanism is the package. The package is both naming & visibility controlled mechanism. Package can be created by including package as the first statement in java source code. Any classes declared within that file will belong to the specified package. Package defines a namespace in which classes are stored. The syntax for defining a package is, package package-name; For e.eg. package mypack;
7 Page 7 of 18 Java uses file system directories to store packages e.g. The.class files of any classes which are declared in a package must be stored in a directory which has same name as package name. The directory name must match with the package name exactly. A hierarchy can be created by seperaring package name & subpackage name by a(.) as mypack.mypack1.mypack2; which requires a directory structure as mypack1\mypack2\mypack3. Example package mypack; public class balance int bal; public balance (int b) bal=b; public void show( ) system.out.println( balance +bal); import mypack.*; class test public static void main ( string args[ ] ) balance b = new balance (1200); b.show( ) (Any other suitable program based on the same concept can also be considered.) Q.3 (e) (4 marks) import java.io.*; class myfile public static void main(string args[]) int ch=0; File f=new File("abc.txt"); try FileReader in=new FileReader(f); while(ch!=-1) ch=in.read(); System.out.println((char)ch);
8 catch(ioexception e) Page 8 of 18 (Any other suitable program based on the same concept can also be considered.) Q.4 (A) (a) Four methods from graphics class 1. drawline( ) (1 Mark) The drawline( ) method is used to draw line which takes pair of coordinates (x1,y1) & (x2,y2) as arguments. The graphics object g is passed to paint ( ) method. The syntax is g.drawline (x1, y1, x2, y2) For e.g. g.drawline (20, 20, 60, 60); 2. drawrect( ) (1 Mark) To draw a rectangle drawrect( ) method is used, which takes four arguments. The first two arguments represents x & y coordinates of top left corner of rectangle & the height of rectangle in pixels. syntax g.drawrect ( x, y, width, height); 3. drawroundrect ( ) (1 mark) This method is used to draw rectangle with rounded corner. This method takes 6 parameters first four are similar to drawrect( ) method. The two extra arguments represent the width & height of angle of corners. These extra parameters indicate how much of corners will be rounded. For e.g. g.drawroundrect (10, 100, 80, 50, 10,100) 4. drawoval( ) (1 mark) The drawoval( ) method is used to draw circle & ellipse. The drawoval( ) method takes four arguments, first two represents the top left corners & other two represents width & height of Oval. For example g.drawoval(20,20,200,120) If width & height arguments are same, then oval becomes circle. For example g.drawoval(70,30,100,100) (Any other valid method can be considered. For each method, 1 M) (b) Serialization (Explanation 4 marks) It s a process of write state of an object to a byte stream. These objects may deserialize later on for restoring. Serialization is also needed to implement Remote Method Invocation (RMI). RMI allows a java object on one machine to invoke a method of java object on a different machine. An object may be supplied as an argument to remote method. The sending machine serializes the object & transmits it. The receiving machine deserializes it. Only an object that implements Serializable interface can be saved & restored by the serialization methods. Serializable interface does not define any member. It is simply used to indicate that the class may be serialized. If a class is serializable all its subclasses are also serializable. Required classes & Interfaces
9 Page 9 of 18 Object output Interface With WriteObject( ) method of this interface object can be serialized ObjectOutputStream Class For writing objects to stream. ObjectInput With readobject( ) objects can be deserialized ObjectInputStream Class For reading objects from a stream Q4 (A) (c) (Any other suitable program based on the same concept can also be considered.) import java.lang.*; import java.io.*; import java.util.*; class palindrome public static void main(string arg[ ]) throws IOException BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter String"); String word=br.readline( ); int len=word.length( )-1; int l=0; int flag=1; int r=len; while(l<=r) if(word.charat(l)==word.charat(r)) l++; r--; else flag=0; break; if(flag==1) System.out.println("palindrome"); else System.out.println("not palindrome");
10 Page 10 of 18 Subject code (d) Switch case statement (2 Marks) Java has a built-in multi way decision statement known as switch. The switch case statement is useful when user have multiple choices. Switch statement tests the value of a given variable against a list of case values & when match is found, a block of statements associated with that case is executed. Syntax switch(expression) case value1 block1; break; case value2 block2; break; default Default block; break; statement n; Example class switchdemo public static void main ( string args[ ] ) int a = Integer.parseInt ( args[0 ] ; switch (a/5) case 1 system.out.println( Poor ); break; case 2 system.out.println( work Hard ); break; case 3 case 4 case 5 system.out.println( Good ); break; system.out.println( Very Good ); break; system.out.println( Excellent ); break; default (2 Marks) system.out.println( Invalid value entered )
11 Page 11 of 18 (Any other valid example can be considered) Q.4 (B) (a) Difference between Array & Vector (4 M) Array Vector 1) Array can accommodate only fixed no. of 1) Vectors can accommodate unlimited no. of elements elements. 2) Array can hold primitive datatype objects 2) Vector can hold only objects 3) The variables in array should be of the same data 3) The objects in Vectors do not have to be type. ie.homogenous homogenous. 4) syntax 4) syntax Datatype arrayname[ ] ; Vector Variable = Datatype arrayname [ ] = new Vector( ); new datatype [size]; Vector Variable = new Vector (size); Each method 1 mark 1. elementat( ) method This method returns n th object from Vector. For eg. list.elementat (n); 2. addelement( ); Adds element specified to the list at the end. For eg. list.addelement( element ); list is object of vector. Q.4 (B) (b)(logic 2 marks, Syntax 2 marks, Design 2 marks ) (Any other suitable program based on the same concept can also be considered.) import java.io.*; import java.lang.*; class Employee String name; int empid; int salary; BufferedReader br=new BufferedReader(new void get() try System.out.println("Enter the Name"); name=br.readline(); System.out.println("Enter the empid"); empid=integer.parseint(br.readline()); System.out.println("Enter the salary"); salary=integer.parseint(br.readline()); InputStreamReader(System.in));
12 catch(ioexception e) void show() System.out.println("Name"+name); System.out.println("EmpId"+empid); System.out.println("Salary"+salary); Page 12 of 18 class emp public static void main(string args[]) Employee e[]=new Employee[5]; for(int i=0;i<5;i++) e[i]=new Employee(); for(int i=0;i<5;i++) e[i].get(); for(int i=0;i<5;i++) e[i].show(); Q.5 (a) (Explanation 2 marks, 2 marks each for each access specifier) Packages add another dimension to access control. Java allows many levels of protection to have a control over visibility of variables and methods within clam, sub clam & package. Clam & package are both means of encapsulating the namespace & scope of variables & methods. Java addresses 4 categories of visibility for clam members. 1. subclass in same package 2. Non subclass in same package 3. sub class in different package 4. Class that are neither in same package nor in sub class. The 3 access specifies public, private & protected provide a variety of ways to produce many levels of access required by these categories. Anything declared as public can be accessed from anywhere. Anything declared as private cannot be seen outside of its class. When a member does not have explicit access specification, it is visible subclasses as well as other classes in same package. This is the default access. If you want to allow an element to be seen outside your current package, but only to classes that subclass your class directly then declare it as protected.
13 Page 13 of 18 Access protection matrix can be shown as follows Sr. Private Default Protected public no. 1 Same package yes yes yes yes 2 Same package sub clam No yes yes yes 3 Different package sub No No yes yes clam 4 Different package nonsub clam No No No yes (b) (Explanation 4 marks, program with applet tag 4 marks) A polygon may be considered as a set of lines connected together. The end of second line is the beginning of third line and so on. Polygon can be drawn using drawpolygon( ) method of Graphics Class. It takes 3 arguments 1. An array of integers containing x-coordinates 2. An array of integers containing y-coordinates 3. An integer for total number of points x & y arrays should be of same size & must repeat the 1 st point at the end of array for closing polygon. Import java.awt.*; Import java. applet.*; Public class drawpoly extends Applet Public void paint(graphics g) Int xpoints [] = 10, 170, 80, 10; Int ypoints[] = 20, 40, 140, 20; Int npoints[] = xpoints.length; g.drawpolygon(xpoints, ypoints, npoints); /*<applet code = drawpoly.class height = 400 width = 400></applet>*/ (Students should have full program written as any example, any other example can be considered)
14 Page 14 of 18 Subject code (c) (Any four differences 1 mark each, program with applet tag 4 marks) Applet Application 1) Applet gives the result in GUI form 1) Application gives output on console 2) Applet does not use main( ) method 2) Application cannot be complete without main ( ) method 3) Applet can not run independently 3) Application can run independently 4) Applets are usually designed for the use on 4) Applications are designed as console application internet 5) Applet require to be embedded in HTML code 5) No such requirement to run an application //Applet program to display welcome to java import java.awt *; import java.applet *; public clam mayapplet extends Applet string str= welcome to java ; public void init ( ) setbackground ( color.blue); setforeground ( color.pink); public void point (Graphics 9) g.drawstring(str,50,50); /* applet code=myapplet height = 100, width =100> </applet*/ Q.6 (a) (2 marks each) A thread is similar to a program that has a single flow of control; it has a beginning, a body of execution & an end. It executes the commands sequentially. A unique property of java is its support for multithreading. Multithreading is that concept where a program is divided into two or more subprogram which can be implemented at the same time in parallel. A thread running in parallel does not really mean that they actually run at the same time. Because all the threads are running of a single processor, the flow of execution is shared between the threads. Java interpreter handle switching of control between the threads in such a way that it appears as they are running concurrently. During life time of thread, it passes through different stages as 1. Newborn 2. Runnable 3. Running 4. Blocked 5. Dead A thread is always in one of these 5 states. A thread can be temporarily suspended or blocked from entering into the runnable and running state by using either of the method or suspend( ), wait ( ) or sleep( ).
15 Page 15 of 18 Subject code wait( ) & notify( ) if a thread requires to wait until some event occurs, it can be done using wait method & it can be scheduled to run again by notify( ) method. wait( ) & notify are required to improve interprocess communication, so all classes should have access to them, that is why they are included in super class of all, i.e. object and we call them in thread because every process in turn is carried out by thread. Wait ( ) actually apply lock on the thread, & the locks are always applied on object, not on thread/process, that is why these methods belong to object class. (b) (1 mark each) The mechanism of creating a new class from an old one is called as inheritance. Here the new class can acquire the properties inherited from old class. The old class is known as base class or super class or parent class & the new one is called as derived class or subclass or child class. inheritance can be of different types 1. A single level inheritance where there can be one parent or super class to one subclass. A B A- Base class, B- derived class 2. Multiple inheritance- where is there can be multiple parent/super classes to a derived class. A B c Where A & B are of super classes & C is a subclass. In java, only with the help of classes multiple inheritance is not possible. You require another concept called as interface to achieve multiple inheritance. 3. Hierarchical inheritance- where is there can be one super class & many classes. A B c D Where A is super class & B, C, & D are subclasses.
16 Page 16 of 18 Subject code Multilevel inheritance where is there can be derived class derived from another sub class. A B c Where C sub class is derived from subclass B which is derived from super class A. Syntax to implement inheritance in java is class subclass extends super class. variable declaration; method declaration; e.g. class fruit //base class class mango extends fruit // derived class (c) (Explanation 2 marks, example 2 marks) Java applet provides their output in GUI form. The output of applet can be seen either in appletviewer window or in any web browser. If we want to see the output of applet in a web browser, we need to embed applet class name in html code with the help of <apple> tag. <Applet> tag has basic attributes as 1. Code- Here class file name of applet can be specified 2. Height- defines height of the window in which the output appears. 3. Width- defines width of the window in which the output appears. Other attributes are 4. Alt- displays short text message if browser is unable to run applet code 5. Align- specifies align of applet such as left, right, top, bottom etc. 6. Codebase specifies URL where class file resides. 7. Uspace-Hspace-specifies space in pixels to keep below & above the applet area & left & right of applet area. 8. Program- It allows to pass applet specific argument through HTML page. They can be accessed in an applet with the help of getparameter ( ) method. Example
17 Page 17 of 18 <html. <body> <applet code=myapplet width=100,height=100> <param name= strl value = abc > </applet> </body> </html> where myapplet is class file of java code. This file with extension.html can be executed through a web browser to get the output. (Any other example can be considered) (d) (Logic 2 marks. Syntax 2 marks)(any other program based on same logic may also be considered) class myclass public static void main(string args[]) int a=0,b=1,c; int i=0; int n=5; System.out.print(b+" "); while(i<=n) c=a+b; System.out.print(c+" "); a=b; b=c; i++; (e) (Explanation 2 marks, example 2 marks)(any other suitable example may also be considered) A constructor initializes an object immediately upon creation. It has the same name as the class in which it resides and is syntactically similar to any method. Once defined, constructor is automatically called immediately after the object is created before new operator completes. Constructions do not have return value but they don t require void as implicit datatype of class constructor is the class type. Parameterized constructor- In case of java when new operator creates an object, a constructor is called. When you don t explicitly define a constructor for a class then java creates a default constructor which automatically defines all variables to zero, null or spaces. Once you use your own constructor, the default constructor is no long valid. If the constructor are defined without parameters, variables can have same values as many times as they are initialized. Instead of this if constructors are defined with parameters, different values can be provided for different objects. Constructors which has parameters are called as parameterized construction. Example Class Rect int length, breadth;
18 Rect(int l, intb) length=l; breadth=b; //parameterized constructor public static void main(string args[ ] ) Rect r=new Rect(8,5); System.out.println( Area= +(r.length*r.breadth)); Rect r1=new Rect(10,12); System.out.println( Area= +(r.length*r.breadth); Page 18 of 18
15CS45 : OBJECT ORIENTED CONCEPTS
15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
Subject Code: 12176 Model Answer Page No: 1 / 33 Q. 1 A) 1) (1-mark each, any four) 1. Compile & Interpreted: Java is a two staged system. It combines both approaches. First java compiler translates source
More information9. APPLETS AND APPLICATIONS
9. APPLETS AND APPLICATIONS JAVA PROGRAMMING(2350703) The Applet class What is an Applet? An applet is a Java program that embedded with web content(html) and runs in a Web browser. It runs inside the
More informationS.E. Sem. III [CMPN] Object Oriented Programming Methodology
S.E. Sem. III [CMPN] Object Oriented Programming Methodology Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 80 Q.1(a) Write a program to calculate GCD of two numbers in java. [5] (A) import java.util.*;
More informationName of subject: JAVA PROGRAMMING Subject code: Semester: V ASSIGNMENT 1
Name of subject: JAVA PROGRAMMING Subject code: 17515 Semester: V ASSIGNMENT 1 3 Marks Introduction to Java (16 Marks) 1. Write all primitive data types available in java with their storage size in bytes.
More informationVidyalankar. T.Y. Diploma : Sem. V [CO/CM/IF] Java Programming Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 100
T.Y. Diploma : Sem. V [CO/CM/IF] Java Programming Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 100 1. (a) (i) FEATURES OF JAVA 1) Compiled and interpreted 2) Platform independent and portable
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More informationPrashanth Kumar K(Head-Dept of Computers)
B.Sc (Computer Science) Object Oriented Programming with Java and Data Structures Unit-IV 1 1. What is Thread? Thread is a task or flow of execution that can be made to run using time-sharing principle.
More informationCompaq Interview Questions And Answers
Part A: Q1. What are the difference between java and C++? Java adopts byte code whereas C++ does not C++ supports destructor whereas java does not support. Multiple inheritance possible in C++ but not
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationOBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70
I,.. CI/. T.cH/C8E/ODD SEM/SEM-5/CS-504D/2016-17... AiIIIII "-AmI u...iir e~ IlAULAKA ABUL KALAM AZAD UNIVERSITY TECHNOLOGY,~TBENGAL Paper Code: CS-504D OF OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More information1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B
1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these 2. How many primitive data types are there in Java? A. 5 B. 6 C. 7 D. 8 3. In Java byte, short, int and long
More informationB2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA
B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationSri Vidya College of Engineering & Technology
UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the
More informationB2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA
B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE
More informationJava Professional Certificate Day 1- Bridge Session
Java Professional Certificate Day 1- Bridge Session 1 Java - An Introduction Basic Features and Concepts Java - The new programming language from Sun Microsystems Java -Allows anyone to publish a web page
More informationLanguage Features. 1. The primitive types int, double, and boolean are part of the AP
Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are
More informationChapter 7 Applets. Answers
Chapter 7 Applets Answers 1. D The drawoval(x, y, width, height) method of graphics draws an empty oval within a bounding box, and accepts 4 int parameters. The x and y coordinates of the left/top point
More information(2½ hours) Total Marks: 75
(2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Makesuitable assumptions wherever necessary and state the assumptions mad (3) Answers to the same question must be written together.
More informationUnit 4 - Inheritance, Packages & Interfaces
Inheritance Inheritance is the process, by which class can acquire the properties and methods of its parent class. The mechanism of deriving a new child class from an old parent class is called inheritance.
More informationContents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance
Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass
More informationDHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING Unit I : OVERVIEW PART A (2 Marks) 1. Give some characteristics of procedure-oriented
More informationI pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.
Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone
More informationBrief Summary of Java
Brief Summary of Java Java programs are compiled into an intermediate format, known as bytecode, and then run through an interpreter that executes in a Java Virtual Machine (JVM). The basic syntax of Java
More informationCore JAVA Training Syllabus FEE: RS. 8000/-
About JAVA Java is a high-level programming language, developed by James Gosling at Sun Microsystems as a core component of the Java platform. Java follows the "write once, run anywhere" concept, as it
More informationChapter 3 - Introduction to Java Applets
1 Chapter 3 - Introduction to Java Applets 2 Introduction Applet Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language)
More informationCHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA
1. JIT meaning a. java in time b. just in time c. join in time d. none of above CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 2. After the compilation of the java source code, which file is created
More informationSyllabus & Curriculum for Certificate Course in Java. CALL: , for Queries
1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads
More informationObject Oriented Programming with Java. Unit-1
CEB430 Object Oriented Programming with Java Unit-1 PART A 1. Define Object Oriented Programming. 2. Define Objects. 3. What are the features of Object oriented programming. 4. Define Encapsulation and
More informationRoad Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets
Java Applets Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Introduce inheritance Introduce the applet environment html needed for applets Reading:
More informationPESIT Bangalore South Campus
PESIT Bangalore South Campus 15CS45 : OBJECT ORIENTED CONCEPTS Faculty : Prof. Sajeevan K, Prof. Hanumanth Pujar Course Description: No of Sessions: 56 This course introduces computer programming using
More informationThird Year Diploma Courses in Computer Science & Engineering, Computer Engineering, Computer Technology & Information Technology Branch.
Third Year Diploma Courses in Computer Science & Engineering, Computer Engineering, Computer Technology & Information Technology Branch. Java Programming Specific Objectives: Contents: As per MSBTE G Scheme
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationThe Sun s Java Certification and its Possible Role in the Joint Teaching Material
The Sun s Java Certification and its Possible Role in the Joint Teaching Material Nataša Ibrajter Faculty of Science Department of Mathematics and Informatics Novi Sad 1 Contents Kinds of Sun Certified
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationF I N A L E X A M I N A T I O N
Faculty Of Computer Studies M257 Putting Java to Work F I N A L E X A M I N A T I O N Number of Exam Pages: (including this cover sheet( Spring 2011 April 4, 2011 ( 5 ) Time Allowed: ( 1.5 ) Hours Student
More informationJava Intro 3. Java Intro 3. Class Libraries and the Java API. Outline
Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries
More informationCS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE
CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate
More informationModule 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet
About Applets Module 5 Applets An applet is a little application. Prior to the World Wide Web, the built-in writing and drawing programs that came with Windows were sometimes called "applets." On the Web,
More informationSELF-STUDY. Glossary
SELF-STUDY 231 Glossary HTML (Hyper Text Markup Language - the language used to code web pages) tags used to embed an applet. abstract A class or method that is incompletely defined,
More informationS.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics
S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics 1 What do you mean by axiomatic Knowledge C254.1 semantics? Give the weakest precondition for a sequence of statements.
More informationSTRUCTURING OF PROGRAM
Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationJAVA. Duration: 2 Months
JAVA Introduction to JAVA History of Java Working of Java Features of Java Download and install JDK JDK tools- javac, java, appletviewer Set path and how to run Java Program in Command Prompt JVM Byte
More informationOBJECT ORIENTED PROGRAMMING. Course 8 Loredana STANCIU Room B613
OBJECT ORIENTED PROGRAMMING Course 8 Loredana STANCIU loredana.stanciu@upt.ro Room B613 Applets A program written in the Java programming language that can be included in an HTML page A special kind of
More informationCS-202 Introduction to Object Oriented Programming
CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction
More informationInheritance. Benefits of Java s Inheritance. 1. Reusability of code 2. Code Sharing 3. Consistency in using an interface. Classes
Inheritance Inheritance is the mechanism of deriving new class from old one, old class is knows as superclass and new class is known as subclass. The subclass inherits all of its instances variables and
More informationObject Oriented Java
Object Oriented Java I. Object based programming II. Object oriented programing M. Carmen Fernández Panadero Raquel M. Crespo García Contents Polymorphism Dynamic binding Casting.
More informationCore Java SYLLABUS COVERAGE SYLLABUS IN DETAILS
Core Java SYLLABUS COVERAGE Introduction. OOPS Package Exception Handling. Multithreading Applet, AWT, Event Handling Using NetBean, Ecllipse. Input Output Streams, Serialization Networking Collection
More informationFull file at Chapter 2 - Inheritance and Exception Handling
Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a
More informationJava Primer. CITS2200 Data Structures and Algorithms. Topic 2
CITS2200 Data Structures and Algorithms Topic 2 Java Primer Review of Java basics Primitive vs Reference Types Classes and Objects Class Hierarchies Interfaces Exceptions Reading: Lambert and Osborne,
More informationGet Unique study materials from
Downloaded from www.rejinpaul.com VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : IV Section : EEE - 1 & 2 Subject Code
More informationSIMPLE APPLET PROGRAM
APPLETS Applets are small applications that are accessed on Internet Server, transported over Internet, automatically installed and run as a part of web- browser Applet Basics : - All applets are subclasses
More informationCS260 Intro to Java & Android 03.Java Language Basics
03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance
More informationJava Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.
Preface p. xix Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. 5 Java Applets and Applications p. 5
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationTWO-DIMENSIONAL FIGURES
TWO-DIMENSIONAL FIGURES Two-dimensional (D) figures can be rendered by a graphics context. Here are the Graphics methods for drawing draw common figures: java.awt.graphics Methods to Draw Lines, Rectangles
More informationComputer Science II (20073) Week 1: Review and Inheritance
Computer Science II 4003-232-01 (20073) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Hardware and Software Hardware Physical devices in a computer system
More informationObject Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming
Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in
More informationInput, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003
Input, Output and Exceptions COMS W1007 Introduction to Computer Science Christopher Conway 24 June 2003 Input vs. Output We define input and output from the perspective of the programmer. Input is data
More informationCS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1
P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java
More informationCore Java Interview Questions and Answers.
Core Java Interview Questions and Answers. Q: What is the difference between an Interface and an Abstract class? A: An abstract class can have instance methods that implement a default behavior. An Interface
More informationJAVA: A Primer. By: Amrita Rajagopal
JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently
More informationSTUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming
More informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationINTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction
INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 9: Writing Java Applets Introduction Applets are Java programs that execute within HTML pages. There are three stages to creating a working Java
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Inheritance Three main programming mechanisms that constitute object-oriented programming (OOP) Encapsulation
More informationVirtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.
1 - What if the main method is declared as private? 1. The program does not compile 2. The program compiles but does not run 3. The program compiles and runs properly ( From Lectuer # 2) 4. The program
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationMethods (Deitel chapter 6)
1 Plan 2 Methods (Deitel chapter ) Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods
More informationMethods (Deitel chapter 6)
Methods (Deitel chapter 6) 1 Plan 2 Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods
More informationJava Object Oriented Design. CSC207 Fall 2014
Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code
More informationCS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?
CS6501 - Internet programming Unit- I Part - A 1 Define Java. Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look
More informationGraphics Applets. By Mr. Dave Clausen
Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported
More informationAtelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.
marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 3 4 Plan 1 2 3 4 A Bit of History JAVA was created in 1991 by James Gosling of SUN. The first public implementation (v1.0) in 1995.
More informationCORE JAVA TRAINING COURSE CONTENT
CORE JAVA TRAINING COURSE CONTENT SECTION 1 : INTRODUCTION Introduction about Programming Language Paradigms Why Java? Flavors of Java. Java Designing Goal. Role of Java Programmer in Industry Features
More informationSRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR
SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc.,CST Semester / Year : EVEN / III Subject Name
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract
More informationJava Programming. MSc Induction Tutorials Stefan Stafrace PhD Student Department of Computing
Java Programming MSc Induction Tutorials 2011 Stefan Stafrace PhD Student Department of Computing s.stafrace@surrey.ac.uk 1 Tutorial Objectives This is an example based tutorial for students who want to
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationOBJECT ORİENTATİON ENCAPSULATİON
OBJECT ORİENTATİON Software development can be seen as a modeling activity. The first step in the software development is the modeling of the problem we are trying to solve and building the conceptual
More information1 OBJECT-ORIENTED PROGRAMMING 1
PREFACE xvii 1 OBJECT-ORIENTED PROGRAMMING 1 1.1 Object-Oriented and Procedural Programming 2 Top-Down Design and Procedural Programming, 3 Problems with Top-Down Design, 3 Classes and Objects, 4 Fields
More informationJAVA MOCK TEST JAVA MOCK TEST III
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationCIS233J Java Programming II. Threads
CIS233J Java Programming II Threads Introduction The purpose of this document is to introduce the basic concepts about threads (also know as concurrency.) Definition of a Thread A thread is a single sequential
More informationCertification In Java Language Course Course Content
Introduction Of Java * What Is Java? * How To Get Java * A First Java Program * Compiling And Interpreting Applications * The JDK Directory Structure Certification In Java Language Course Course Content
More informationCOURSE 11 PROGRAMMING III OOP. JAVA LANGUAGE
COURSE 11 PROGRAMMING III OOP. JAVA LANGUAGE PREVIOUS COURSE CONTENT Input/Output Streams Text Files Byte Files RandomAcessFile Exceptions Serialization NIO COURSE CONTENT Threads Threads lifecycle Thread
More informationJava Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application
Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An
More informationQuiz on Tuesday April 13. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 4. Java facts and questions. Things to try in Java
CS 361 Concurrent programming Drexel University Fall 2004 Lecture 4 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationSoftware Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)
Software Development & Education Center Java Platform, Standard Edition 7 (JSE 7) Detailed Curriculum Getting Started What Is the Java Technology? Primary Goals of the Java Technology The Java Virtual
More informationINHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U
C A N A D I A N I N T E R N A T I O N A L S C H O O L O F H O N G K O N G INHERITANCE & POLYMORPHISM P2 LESSON 12 P2 LESSON 12.1 INTRODUCTION inheritance: OOP allows a programmer to define new classes
More informationIntroduction to Java
Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 21, 2013 Abstract
More informationBy: Abhishek Khare (SVIM - INDORE M.P)
By: Abhishek Khare (SVIM - INDORE M.P) MCA 405 Elective I (A) Java Programming & Technology UNIT-2 Interface,Multithreading,Exception Handling Interfaces : defining an interface, implementing & applying
More informationCS 11 java track: lecture 3
CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces
More informationZhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson
Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program
More information