Skip to content
VUBuddy

CS506 Midterm Solved Subjective with References by Moaaz

Web Design and Development PDF 232 KBUpdated 23 Oct 2026
Midterm past paper CS506 Midterm Solved Subjective with References by Moaaz PDF 232 KB
vubuddy.com
Type
Midterm past paper
Course
CS506 Web Design and Development
Size
PDF 232 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 232 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2, 3 of 12. Download the file for all 12 pages.

CS506- Web Design and Development · Solved Subjective · From Midterm Papers · April 30,2012 · PSMD01 · CS506 Midterm fall 2011 papers

Q1. Why we use serialization, (2 marks)

Answer: (Page 219) Used to send an object to a stream

Q2. Differentiate between array and ArrayList . (2 marks)

Answer: (Page 61) It’s like a resizable array. ArrayList actually comes as a replacement the old “Vector” collection. As we add or remove elements into or from it, it grows or shrinks over time.

Q3. Write the syntax to load the oracle driver . (2 marks)

Answer: (Page 152)

Q4. What will happen if an image drawn out of the window coordinates? . (5 marks)

Q5. How we process the results of sql query. (5 marks)

Answer: (Page 153)

Process Results of the Query

  •  The ResultSet provides various getXXX methods that takes a column index or name and returns the data
  •  The ResultSet maintains the data in the form tables (rows & columns)
  •  First row has index 1, not 0.
  •  The next method of ResultSet returns true or false depending upon whether the next row is available (exist) or not and moves the cursor
  •  Always remember to call next() method at-least once
  •  To retrieve the data of the column of the current row you need to use the various getters provided by the ResultSet.
  •  For example, the following code snippet will iterate over the whole ResultSet and illustrates the usage of getters methods

while ( rs.next() ){ //by using column name String name = rs.getString(“columnName”);

// or by using column index String name = rs.getString(1);}

Q6. How a window handle its own events. (3 marks)

Using listeners is the preferred way of handling events since it is easier than enabling events directly for an object, and the code is clearer. Nonetheless, we should take a look at how you deal with events after calling enableEvents().

Diff b/w array n arraylist? 2marks

Answer: rep

automatic reading in serialization?3marks

Answer: (Page 220) System knows how to read data from stream and re-create object in memory. The recreated object is type of “Object” therefore Down-casting is required to convert it into actual type.

GUI drivers? 3marks

Java GUI Drivers

  •  Several well-developed open-source tools
  •  Some are more for unit testing GUIcomponents. Others are for system oracceptance testing.
  •  Use various methods for triggering controls:
  •  Use Robot to generate native OS events
  •  Generate AWT events
  •  Drive control components directly

What is advantage of collection over array?[2]

Answer: (Page 60) Advantage of a collection over an array is that you don’t need to know the eventual size of the collection in order to add objects to it.

Which method of ResultSetMetaData objective is used to return the suggested value to column label for printout?[2]

Answer: (Page 175) The getColumnLabel() method returns the suggested column label for printouts

If a method is declared in protected where it can be accessible?[2]

Answer: It can be accessible to only to the class to which they belong, and any subclasses

What will happen if class implemented WindowListner interface and provided its definition of only one method? [3]

Answer: To handle window events, we need to implement “WindowListner” interface. To handle window events, we need to implement “WindowListner” interface. “WindowListner” interface contains 7 methods We require only one i.e. windowClosing But, We have to provide definitions of all methods to make our class a concrete class, if don’t do this we can not create its object.

State the name of the class with which Window like container can be declared for GUI and animation based Web application. And explain it. [3]

Write down the steps of make Client on Java Client Server application. [5]

Answer: (Page 175)

Steps – To Make a Simple Client

To make a client, process can be split into 5 steps. These are:

1. Import required package

You have to import two packages

. java.io.*;

2. Connect / Open a Socket with Server

Create a client socket (communication socket) Socket s = new Socket(“serverName”, serverPort) ;

serverName : Name or address of the server you wanted to connect such as or 172.2.4.98 etc. For testing if you are running client and server on the same machine then you can specify “localhost” as the name of server

serverPort : Port number you want to connect to The scheme is very similar to our home address and then phone number.

3. Get I/O Streams of Socket

Get input & output streams connected to your socket

For reading data from socket As stated above, a socket has input stream attached to it.

InputStream is = s.getInputStream(); // now to convert byte oriented stream into character oriented buffered reader // we use intermediary stream that helps in achieving above stated purpose InputStreamReader isr= new InputStreamReader(is); BufferedReader br = new BufferedReader(isr);

For writing data to socket A socket has also output stream attached to it. Therefore,

OutputStream os = s.getOutputStream();

// now to convert byte oriented stream into character oriented print writer

// here we will not use any intermediary stream because PrintWriter constructor // directly

All CS506 files →
CS506 Web Design and Development All CS506 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.