Solved Assighnments
Course:Programming Language–III (3415)
Level: B.S (CS) Semester: Autumn- 2015
Total Marks: 100 Pass Marks: 50
ALLAMA IQBAL OPEN UNIVERSITY, ISLAMABAD
(Department of Computer Science)
WARNING
- PLAGIARISM OR HIRING OF GHOST WRITER(S) FOR SOLVING THE ASSIGNMENT(S) WILL DEBAR THE STUDENT FROM AWARD OF DEGREE/CERTIFICATE, IF FOUND AT ANY STAGE.
- SUBMITTING ASSIGNMENTS BORROWED OR STOLEN FROM OTHER(S) AS ONE’S OWN WILL BE PENALIZED AS DEFINED IN “AIOU PLAGIARISM POLICY”.
Course: Programming Language–III (3415) Semester: Autumn, 2015
Level: Bachelor Total Marks: 100
Pass Marks: 50
ASSIGNMENT No. 1
Note: All questions carry equal marks.
Q. 1 (a) Explain what a Javaapplication is. Why we use comments in Java applications?
(b) Define and explain the term JVM (Java Virtual Machine).
Q. 2 (a) Why we say that Javais an object oriented language?
Q. 3 (a) What is a data type? Write in detail the data types used in Java language.
(b) How arrays are declaredand allocated in Java? Also explain the references and referenceparameters in Java.
Q. 4 The factorial of a nonnegative integer n is written n! (Pronounced “n factorial”) and is defined as follows:
n! = n (n-1) (n-2)… 1 (for values of n greater than or equal to 1) and n! = 1 (for n = 0).
For example, 5! = 5.4.3.2.1, which is 120.
(b) Write an application that estimates the value of the mathematical constant eby using the formula
(a) References and referenceparameter
(c) Third element of array and array element 3
Ans:
Suppose you have an Array
Sring arr[] = {"html","css","java script"};
The third element of the array is "java script" but it's position would be fouind as [2] in the array. You are supposing it as 3, and that's why you are getting the errors.
Ans:
Suppose you have an Array
Sring arr[] = {"html","css","java script"};
The third element of the array is "java script" but it's position would be fouind as [2] in the array. You are supposing it as 3, and that's why you are getting the errors.
ASSIGNMENT No. 2
Total Marks: 100
Pass Marks: 50
Note: All questions carry equal marks.
(b) What are packages inJava? Briefly describe the Java API packages.
Q. 2 Distinguish between inheriting interface and inheriting implementation. How doinheritance hierarchies designed for inheriting interface differ fromthose designed for inheriting implantation?
Q. 3 (a) Briefly describe the constructors of class string? Also write demonstrating of Stringclass constructors in Java.
Q. 4 What is polymorphism? Describe with an example.
Q. 5 (a) Write a program inJava having parent and child classes to demonstrate the concept ofinheritance.
Programming Language–III (3415) Credit Hours: 4(3+1)
Recommended Book:
JAVA, How to Program, By Deital & Deital 3rdEdition
Course Outlines:
Unit No. 1 Introduction to Java Applications
Introduction, Using Comments, Block of Codes, a Simple Java Program
Unit No. 2 Data Types & Arrays
Data Types, Declaring & Allocating Arrays, References and Reference Parameters Searching Arrays, Multiple Subscripted Arrays
Unit No. 3 Control Structures-I
Selection Structure, While Repetition Structure
Unit No. 4 Control Structures-II
For Repetition Structure, Do/While Repetition Structure, Break and Continue, Multiple Selection Structure
Unit No. 5 Object Oriented Programming-I
Introduction to Class, Class Scopes, Creating Packages, Constructors, Set & Get Method, This Reference, Finalizer, Static Class Member
Unit No. 6 Object Oriented Programming-II
Super Class, Sub Classes, Protected Members, Inheritance, Polymorphism, Dynamic Method Binding, Inner Class Definitions
Unit No. 7 Packages, Interfaces, and Exception Handling
Defining a Package, Access Protection, Importing Packages, Interfaces Exception-Handling Fundamentals, Exception Types, Using Try & Catch, Java Built-In-Exceptions
Unit No. 8 Strings & Characters
String Constructors, String Comparing, String Methods, String Concatenating, String Classes, String Methods
Unit No. 9 GUI
Graphics Context, Graphic Methods, Color and Font Control, Drawing Shapes, Java 2d API, Java 2d Shapes, Swing Overview, Jlable, Event Handling Model, Jbutton, Jtextfield, Jradiobutton, Jcheckbox, Jlist, Multiple Selection List, Mouse Event Handling, Keyboard Event Handling, Layout Managers