Professional Documents
Culture Documents
Question# 3 Write the complete History of Java? Who Developed Java? When Java developed?
Question# 4 Why Java Developed?
Question# 5 What are Java Buzzwords? Define each of the Java Buzzwords?
Question# 6 What are the features of Java?
Question# 7 Do As Directed….
a. Define
a. JRE
b. JIT
c. JVM
d. Byte Code
e. Java is Platform Independent
f. JDK? Why it is used? What are its advantages?
g. When first Version of JDK was launched? Which version is currently
in use?
h. In which language does the Java Compiler is written
i. In which language does the C++ Compiler was written
j. Does Java Support Pointers?
k. List down various types of applications that can be developed in Java
l. What is J2EE, J2SE, J2ME. Also write down the difference between
J2EE, J2SE, J2ME
m. What is JRE? Why JRE is used?
n. Is Java a Compiled or an Interpreted programming language?
o. Define Just-in Time Compiler
p. Define JVM? Why JVM is used?
q. Write down Complete Procedure diagrammatically how the Java
Program is compiled and executed
r. Define Object Cloning
Question# 8 Complete the Following Table and add as many rows to table as needed
Table 1: Java Version Development Years
S# Version Developed On (Enter Date of Release)
1 Java 1.0
2
3
4
5
6
7
Question# 9 Write down at least ten Editor available for Java program development?
Question# 10 Write down the type of Applications which can be developed using Java?
Question# 11 Write the program structure of Java
Question# 12What the output statements are available in Java? How Java Program read Inputs
from Users
Question# 13
(a) Declare One Dimensional Array of Size 100 and Initialize all its Elements to 0
(b) Declare Two Dimensional Array of Size 5 X 7 and Initialize all its Elements to 0
(c) Declare One Dimensional Array of Size m and Initialize all its Elements to 0. Where m is the
(d) Declare Three Dimensional Array of Size 3 X 4 X 6 and Initialize all its Elements to 0.
(e) Search for the different built-in Java Array Functions. Give an example against each of the
Question# 14
(a) Why the Scanner Class is used in Java
(c) How you can read data using the Scanner class in an Integer Array
(d) How you can read data using the Scanner class in an Integer Array
(e) How you can read data using the Scanner class in an String Array
(f) How you can read data using the Scanner class in an Floating Point Array
Question# 15
a. How an array of type String is declared
b. Write down all the built-in String class methods available in Java. Give an example for
Question# 16 Differentiate
a. Class and Object
Question# 17
a. What is Interface
f. How you will use Interfaces to have the multiple inheritance in Java
Modern Programming Languages Assignment
Assignment No. 2
Q No.2 Suppose we have the following a table named “tblOrderDetails (OrderID, ItemName,
Quantity, Price)” in the database nameddb_Super_Store. Your task is to code in Java to MySQL
iii. Find how much quantity has been ordered upto now for Item Name = “Laptops”[Marks: 03]
iv. Implement the Exception Handling where necessary. Your program also check that Quantity
v. Item Name cannot be NULL as well as each Item Name length cannot be less than 5.
[Marks: 01]
Q No.3 In Java keyword final is used to prevent overriding and inheritance. Explain these two
uses of final keyword in Java with programming examples. [Marks: 02]
Q No.4 Design a calculator application in Java and then code for the following functions
Q No.5 Create a file in D drive. Add the following Text into this file using Java Code. Finally,
perform the following operations on this text file. [Marks: 20]
Question 3: [Marks: 2]
A cloth showroom has announced the following seasonal discounts on purchase of items:
0 – 100 - 5.00%
Write a program using switch and if statements to compute the net amount to be paid by a customer.
Question 4: [Marks: 3]
Design a class in Java for Patient with Patient_Number, Patient_Name, Disease_Type instance variables.
Add methods for reading, displaying and searching data. Finally, instantiate the class and test the class
methods.
MID Examination – Summer 2016
BSCS/MCS
1. JVM will differ from platform to platform but still all understand the Same Java Bytecode
[True/False]
2. JVM is a _____________ .
a. Interpreter b. Debugger c. Assembler d. Compiler
3. Which of the following statements about the Java language is true?
a. Both procedural and OOP are supported in Java.
b. Java supports only procedural approach towards programming.
c. Java supports only OOP approach.
d. None of the above.
4. Which of these is correct way of inheriting class A by class B?
a) class B + class A {}
b) class B inherits class A {}
c) class B extends A {}
d) class B extends class A {}
5. What of the following limits a class and its members to be used only within the class, classes
within same package and classes that inherits them.
a. public b. private c. protected d. default
The command to execute a compiled program is _________
a. run b. execute c. javac d. java
6. Which of the following is NOT an advantage to using inheritance?
a. Code that is shared between classes needs to be written only once.
b. Similar classes can be made to behave consistently.
c. Enhancements to a base class will automatically be applied to derived classes.
d. One big superclass can be used instead of many little classes.
7. Which of these keywords must be used to monitor for exceptions?
a) try b) finally c) throw d) catch
8. Define the following terms
a. Java is platform independent language
b. Method overriding Vs Method Overloading, provide programming Example
c. Use of Super keyword in Java
Q No.2 Design a Class named PakistanMotorWay. In this Class, you are required to manage the different
types Vehicles passing on daily basis. You are also required to enter the different type of Vehicles and Tool
Rate for each Vehicle. Also, your program should display a Menu for different Choices. As the user chooses
a choice then your application should respond accordingly. The sample run and output of the program is
show below. Implement this entire scenario using Java Classes. Inheritance, Interfaces (if required). Only
neat and working code will give you marks. No marks will be given if code is not written clearly. You
program should display the Menu repeatedly until he/she choose the option 5 or 6 and display the complete
details as shown[3 Marks]
Sample Run
Program Menu : Please Enter your Choice
0 : Car
1 : Bus
2 : Jeep
3 : Truck
4 : Long Vehicle
5 : Exit
6 : Report Display
Sample output
****************** Pakistan Motorway ******************
****************** Islamabad Tool Plaza******************
S# Vehicle Type # of Entries Total Tool
1 Car 10 500
2 Bus 10 1000
3 Jeep 5 10000
4 Truck 15 10000
5 Long Vehicle 10 100