CS1401 INTERNET COMPUTING Two Marks Questions With Answers 2014

Anna University, Chennai

Anna_University,_Chennai_logo

SRINIVASAN ENGINEERING COLLEGE Department of Computer Science

2013-2014

Odd Semester

CS1401 INTERNET COMPUTING UNIT – I

FUNDAMENTALS

PART A

1. What is the difference between node and host?

A node is any addressable device connected to a network whereas the host is a more specific

descriptor that refers to a networked general-purpose computer rather than a single purpose device (such as a printer).

2. What is the purpose of routers?

Router operates like electronic postal workers that evaluate and forward packets between

networks.

3. Define protocol.

A protocol is a formal set of rules that must be followed in order to communicate.

4. Why are the protocols layered?

Layering protocols simplifies the task of communicating over the network and it allows for reuse

of layers that are not specific to a particular application.

5. Define encapsulation.

Placing the data inside a package of headers is known as encapsulation.

6. Define port.

A port is a logical channel to an application running on a host. ie., The applications running on

the host machines are uniquely identified by port numbers.

7. Define URI, URL, and URN.

1. URI (Uniform Resource Identifier): It identifies an object on the Internet.

2. URL (Uniform Resource Locator): It is a specification for identifying an object

Such as a file, newsgroup, CGI program or e-mail address by indicating the exact location on the internet.

3. URN (Uniform Resource Name): It is a method for referencing an object without declaring the full path to the object.

8. What is the difference between TCP and UDP?

TCP:

UDP:

Connection oriented transport protocol Sends data as a stream of bytes Guarantee of delivery

Connection less protocol

Datagram service

No guarantee of delivery.

9. Define IP Address?

Each host computer on the internet has a unique number and it is called as internet protocol

Address.

10.Define Web page, Web site &Web browser?

1.A Web page is a document created using HTML.

2.A Web site is a collection of related pages.web pages and sites can be stored on the hard drive of a

local computer or a web server.

3.A Web browser is a program that displays the web pages it retrieves.

11. Define HTML.

It is a simple page description language, which enables document creation for theweb.

12. What do you mean by well-known ports?

Port numbers can range from 1 to 65535, however ports 1 to 1023 are reserved. These reserved

ports are referred to as we1l-known ports because the Internet Assigned Numbers Authority publicly documents the applications that use them.

13. What is meant by Name Resolution?

Name Resolution is the process of mapping a hostname to its corresponding IP Address.One way

to translate a hostname to an IP address is to look it up in a simple text file.The second way is the domain name service, which is a distributed database containing all

registered hostnames on the Internet and their IP addresses.

14. Define protocol tunneling.

Protocol tunneling is the process of encapsulating one protocol within another protocol that

operates on the same layer.

15. What are the components of HTTP URL?

The components are host, an optional port, path, filename, section and query string.

16. Define URL encoding.

URL encoding involves replacing all unsafe and nonprintable characters with a

percent sign (%) followed by two hexadecimal digits corresponding to the character’s ASCII

value.

17. What does ICMP provide?

ICMP provides

1. Error messaging

2. Demand reply functions

18. Define IGMP.

It is Internet Group Management protocol. It provides

1. Broadcasting

2. Multicasting

19. List the goals of SGML.

I. To manage the flow of millions of pages.

2. For structuring information exchange

3. For modeling inter-document linkages

4. For managing information flows between departments and weapons systems

20. What are the necessities of using HTML forms?

1. Gathering user information

2. Conducting Surveys

3. Interactive services

21. What are the sequences of steps for each HTTP request from a client to the server?

1. Making the connection

2. Making a request

3. The response

4. Closing the connection

22. Define MIME.

MIME (Multipurpose Internet Mail Extensions) is an open standard for sending

multipart, multimedia data through Internet email.

23. List the predefined MIME content types.

1. Text

2. Multipart

3. Message

4. Image

5. Audio

6. Video

7. Model

8. Application

24. What is meant by loop back address?

A zone that enables the server to direct traffic to itself. The host number is almost

always 127.0.0.1.

25. List down font characteristics permitted in style sheets.

1.font-family

2.font-size

3.font-weight

4.font-style

5.font-variant

26. What are Style Sheets?

Style sheets are collections of style information that are applied to plain text. Style information

includes font attributes such as type size, special effects (bold,italic,underline),

color and alignment. Style sheets also provide broader formatting instructions by specifying values for quantities such as line spacing and left and right margins.

27. List down the ways of including style information in a document.

1.External Styles -Style information is read from a separate file that is specified in the

<LINK> tag

2.Embedded Styles -Style information is defined in the document head using the

<STYLE> and </STYLE> tags.

3.Inline Styles -Style information is placed inside an HTML tag and applies to all content between that tag and it companion closing tag.

28. Define cascading.

Cascading refers to a certain set of rules that browsers use, in cascading order, to determine how

to use the style information. Such a set of rules is useful in the event of conflicting style information because the rules would give the browser a way to determine which style is given precedence.

29. What are the style precedence rules when using multiple approaches?

Inline styles override both linked style sheets and style information stored in the document head

with <STYLE> tag. Styles defined in the document head override linked style sheets. Linked style sheets override browser defaults.

UNIT 2

SERVER SIDE PROGRAMMIG

PART A

1. What is the role of server?

1. Manages application tasks

2. Handles storage

3. Handles security

4. Provides scalability

5. Handles accounting and distribution

2. Define CGI -Common Gateway Interface.

A specification for transferring information between a World Wide Web server and a CGI

program. ACGI program is any program designed to accept and return data that conforms to the CGI specification. The program could be written in. any programming language, including C, Perl, Java, or Visual Basic.

3. Write a note on Internet Information Server (IIS).

Microsoft’s Web server that runs on Windows NT platforms, In fact, IIS comes bundled with

Windows NT 4.0. Because IIS is tightly integrated with the operating system, it is relatively easy to administer. However, currently IIS is available only for the Windows NT platform, whereas Netscape’ s Web servers run on all major platforms, including Windows NT platform, OS/2 and UNIX.

4. What are ISAPI (Internet Server API) and NSAPI (Netscape Server API)

ISAPI (Internet Server API): An API for Microsoft’s IIS (Internet Information

Server) Web server. ISAPI enables programmers to develop Web-based applications that run much faster than conventional CGI programs because they’re more tightly integrated with the Web server. In addition to IIS, several Web servers from companies other than Microsoft support ISAPI. NSAPI -Netscape Server API: An API for Netscape’s Web servers.

NSAPI enables programmers to create Web-based applications that are more sophisticated and run much faster than applications based on CGI scripts.

5. What is API -Application Program Interface?

A set of routines, protocols, and tools for building software applications. A good API makes it

easier to develop a program by providing all the building blocks. A programmer puts the blocks together. Most operating environments, such as MS- Windows, provide an API so that programmers can write applications consistent with the operating environment.

6. What are Servlets?

A small program that runs on a server, the term usually refers to a Java applet that runs within a Web server environment. This is analogous to a Java applet that runs within a Web browser environment.Java servlets are becoming increasingly popular as an alternative to CGI programs. The biggest difference between the two is that a Java applet is persistent. This means that once it is started, it stays in memory and can fulfill multiple requests. In contrast, a CGI program disappears once it has fulfilled a request. The persistence of Java applets makes them faster because there’s no wasted time in setting up and tearing down the process.

7. What are Applets?

A program designed to be executed from within another application. Unlike an application,

applets cannot be executed directly from the operating system. With the growing popularity of OLE (object linking and embedding), applets are becoming more prevalent. A well-designed applet can be invoked from many different applications. Web browsers, who are often equipped with Java virtual machines, can interpret applets from Web servers. Because applets are small in files size, cross-platform compatible, and highly secure (can’t be used to access users' hard drives), they are ideal for small Internet applications accessible from a browser.

8. What do you mean by Server-side?

Occurring on the server side of a client-server system. For example, on the World Wide Web,

CGI scripts are server-side applications because they run on the Web server. In contrast, JavaScript scripts are client-side because they are executed by your browser (the client). Java applets can be either server-side or client- side depending on which computer (the server or the client) executes them.

9. What is a protocol?

An agreed-upon format for transmitting data between two devices. The protocol

determines the following:

1.The type of error checking to be used

2.Data Compression method, if any

3.How the sending device will indicate that it has finished sending a message

4.How the receiving device will indicate that it has received a message

10. What is ActiveX?

A loosely defined set of technologies developed by Microsoft for sharing

information among different applications. ActiveX is an outgrowth of two other Microsoft technologies called OLE (Object Linking and Embedding) and COM (Component Object Model).As a moniker, ActiveX can be very confusing because it applies to a whole set of COM-based technologies. Most people, however, think only of ActiveX controls, which represent a specific way of implementing ActiveX technologies.

11. Write a note on ActiveX controls.

A control using ActiveX technologies. An ActiveX control can be automatically

downloaded and executed by a Web browser. ActiveX is not a programming language, but rather a set of rules for how applications should share information. Programmers can develop ActiveX controls in a variety of languages, including C, C++, Visual Basic, and Java.

An ActiveX control is similar to a Java applet. Unlike Java applets, however, ActiveX controls have full access to the Windows operating system. This gives them much more power than Java applets, but with this power comes a certain risk that the applet may damage software or data on your machine. To control this risk, Microsoft developed a registration system so that browsers can identify and authenticate an ActiveX control before downloading it. Another difference between Java applets and ActiveX controls is that Java applets can be written to run on all platforms, whereas ActiveX controls are currently limited to Windows environments. Related to ActiveX is the scripting language VBScript that enables Web authors to embed interactive elements in HTML documents.

12.Explain about HTTP Connection.

It is a communication channel between web browser and web server. It begins on the

client side with the browser sending a request to the web server for a document. Request Header Fields are

1. From

2. Reference

3. If_modified_since

4. Pragma

5. User Agent

13. What is meant by Stateless Connection?

When a web server receives a HTTP request from a web browser it evaluates the request and

returns the requested document, if it exists, and then breaks the HTTP connection.This document is preceded by the response header, which has details about how to display the document that will be sent by the server. Each time a request is made to the server, it is as if there was no prior connection and each request can yield only a single document. This is known as Stateless Connection.

14. Write a note on Environment variables.

In CGI, the server prepares the environment variables before it launches the CGI script. These

represent the current state of the server that is asking for the information. The environment variables are not set from the command line but are created on the fly, and lasts

only until that particular script is finished. Each script gets its own unique set of variables and multiple scripts can be executed at once, each in its own environment.

15. What are STDIN and STDOUT?

These are mnemonics for standard input and standard output, two predefined stream / file

handles. Each process already inherits these two handles already open. From the script’s point of

view, STDIN is what comes from the browser via the server when the post method is

used, and the STDOUT is where it writes its output back to the browser. The script picks up the environment variables and reads STDIN as appropriate. It then does whatever it was designed to do and writes its output to STDOUT.

16. What are the two commonly used Request methods?

The request methods tell the script how it was invoked. Based on this information, the script

decides how to act. The request method is passed to the script using environment variable called

REQUEST- METHOD. The two most common request methods used are GET and POST.

GET

GET is a request for data, the same method used for obtaining static documents. The GET

method sends request information as parameter tacked onto the end of the URL. These parameters are passed to the CGI program in the environment variable QUERY-STRING.

E.g.: If the script is called myprog.exe and is invoked from a link with the form

<A HREF="cgi-bin/myprog.exe? lname=blow&fname=joe"> The REQUEST_METHOD will be the string GET, and the QUERY_STRING will contain lname=blow &fname=joe.

A mandatory question mark separates the name of the script from the beginning of the QUERY_STRING. If a slash is used instead of the question mark; the server passes the information to script using the PATH_INFO variable instead of the QUERY_STRING variable. POST

POST operation occurs when the browser sends data from a fill-in form to the server. With

POST, the QUERY_STRING mayor may not be blank, depending on the server.The data from a POSTed query gets passed from the server to the script using STDIN. Because STDIN is a stream and the script needs to know how much valid data is waiting, the server also Supplies another variable, CONTENT_LENGTH, to indicate the size in bytes of the incoming "data. The format for POSTed data is Variable1=value1 & variable2=value2 &etc.

17. Explain about URL Encoding.

HTTP specification requires that the URL data should be encoded in such a way that it can be

used on almost any hardware and software platforms. Information specified in this way is called URL encoded. If parameters are passed as a part of query string or path information, they will take the form of ‘Name-Value’ pairs. variablel=valuel&variable2=value2& so on for each variable defined in the form.

18. List the advantages of CGI scripting?

I. CGI programs are relatively safe to run.

2. A CGI program can crash without damaging the server, since it only has limited access to the server.

3. Reduces the burden of server

a. Sends prepared messages / mails e customer reply

b. Capability to process forms and prepares output based on form input. c . Hit counts / Page counters.

19. Explain about Session tracking.

A session is basically a conversation between a browser and a server. All the above technologies can save information for the current session for a particular user visiting a site. The session is important, as H1TP is a stateless protocol.

20. Define scriptlets.

Scriptlets enable you to create small, reusable web applications that can be used in

any web page. Scriptlets are created using HTML, scripting and Dynamic HTML. To include them in an HTML document use the <OBJECT> tag.

21. Define ASP.

Active Server Pages (ASP) is a server-side scripting technology that can be used to

create dynamic and interactive web applications.

22. What are the ASP objects?

1.Application -It manages your web application.

2.Session -It manages and tracks individual user sessions.

3.Server -It controls behavior of your web server

4.Response -It transmits information from the web server to web browser

5.Request -It retrieves information from the browser for processing at the server.

23. What is global.asa file?

The global.asa file is a Active Server Application file you can track and manage the

application and session events, variables and objects. When you start the application the server will load the global.asa file into memory.

24. Define response object and list its methods.

The response object transmits information from the web server to browser.

Methods are:

1.Write

2.BinaryWrite

3.Redirect

4.AppendToLog

5.AddHeader

6.Clear

7.Flush

25. Define JSP.

Java Server Pages (JSP) are simple technology used to generate dynamic HTML on

the server side.

26. Define Directives.

Directives are JSP elements that provide global information about an entire JSP page.

27. Write down the various attributes for the page directives in JSP.

The page directive defines information that will be globally available for that Java

Server Page,

1. language

2. extends

3. import

5. buffer

6. contenttype

28. What is meant by firewall?

A firewall is a piece of network hardware that serves as a secure gateway between an internal

network and the Internet. It protects the internal network from unauthorized access or activity,

29. Write a note on proxy server.

A proxy server is a host that makes Internet request on behalf of other machines on the network,

Proxy servers are often used to cache frequently requested files or to monitor Internet use within a Corporation.

30. What is meant by Plug-in?

A hardware or software module that adds a specific feature or service to a larger system. The

idea is that the new component simply plugs in to the existing system. For example, there are number of plug-ins for the Netscape Navigator browser that enable it to display different types of audio or video messages. Navigator plug-ins are based on MIME filetypes.

31. What do you mean by JDBC?

JDBC Part of the Java Development Kit which defines an application-programming

interface for Java for standard SQL access to databases from Java programs.

32. Define ODBC.

It is a standard for accessing different databse systems. There are interfaces for Visual

Basic, Visual C++, SQL and the ODBC driver pack contains drivers for the Access, Paradox, dBase, Text, Excel and Btrieve databases.

.33.Define SSI.

Server Side Includes (SSI) gives you a way to insert the content of another file into a file before the web server processes it.


UNIT III

XML TECHNOLOGY FAMILY

1.How XML differ From HTML?

HTML

XML

1.HTML only displays and focuses on how Xml

data looks

Describes and focuses on the data

2. HTML is all about displaying information

XML all about information

3. HTML is not extensible

XML is extensible

4.HTML tags are predefined user must not invent

his tags

XML tags are not predefined user must invent his

tags

5. HTML tags are not case sensitive

XML tags are case sensitive

2.What is the use of XML?

· XML files are human readable.

· Widespread industry support exists for XML.

· Major relational database are now have the native capability to read and generate XML

data.

3.What to you mean by DTD in XML?

In XML sender can use a DTD to create XMLdocuments.On the receiving end the server can compare an incoming XML document against the DTD and determine if the incoming XML data is valid with respect to the DTD.Ifnot,it can be return a message indicating an error in the incoming format.

4.What is the use of XML Namespace with example?

XML Namespace is a simple technology solution that allows elements and attribute name to be distinguished from the similarity named elements and attributes of other XML users.

It solves the problem of clashing names.

Eg:

<?xml version=”1.0”?>

<Book xmlns=http://www.library.com>

<lib:Title> xml webservices and the data revolution</lib:Title>

<lib:Author>Frank p.coyle</iib:Author>

</Book>

5.What is the usage of CSS?

A simple mechanism for adding style(such as fonts,colors, or spacing) to web documents. Multiple levels of CSS can be used to allow selective overriding of styles.

6. Define EDI?

It is the exchange of information in a standard format between computers without any human intermediary.

7. What is DOM?

DOM is a W3C supported application program interface(API) that provides a platform and languages neutral interface to allow developers to programmatically access and modify the content and structure document such as HTML or XML.

8, Define XML schema?

An XML schema defines the structure of an XML document.In other words,It describes the valid format of an xml dataset.

9. Define XHTML

· XHTML is an effort by the W3C to replace HTML with more flexible approach to displaying web content.

· It differs from HTML in that it is based on XML,not SGML.

10. What is XSLT?

XSLT is an XML-based language used to transform XML documents into other formats

such as HTML for Web display, WML for display on WAP devices.

11.what are the use of XLink,Xpath,Xquery

· Xlink-enadlebirectional web linking.

· Xpath used to navigate XML tree structure.

· Xquery brings database query processing to XML.

12.What is metadata?

· Metadata includes the indexing and organization required to retrieve library material such as book by author,title,or subject.

· Metadata:Information about information.


UNIT IV

1.What is SOAP?

SOAP

· SOAP is an XML-based protocol for exchanging information in a decentralized, distributed environment.

· SOAP defines XML envelope for delivering XML content across HTTP as well

as other protocols and specifies a set of rules for servers to follow when receiving a SOAP message.

2.Define XML-RPC?

XML-Remote Procedure Call is aprotocol for doing remote procedure calls over the web where the information about what procedure to call and what parameters to pass are encoded as XML in the body of an HTTP POST requests to a server.

3. What is meant by SOAP Fault?

· The SOAP Fault information item is used to carry error and status information within a

SOAP message.

· SOAP Fault MUST appear as a direct child of the SOAP body and MUST NOT appear more than once within a SOAP body.

4.What is meant by SOAP Actors?

· If the SOAP actor attribute is not present in a header, then the recipient of the message is considered the final destination.

· If the application is not the ultimate destination of the message, then it must remove all header elements intended for it before forwarding the message.

5. Define SOAP with attachments

A binding for a SOAP message that allows additional information to be transported with the message using HTTPs multi part messaging.DTDsstylesheets,and digital digest to be sent as auxiliary information with a single SOAP message.

6.Write about SOAP design Patterns.

Architectural design patterns capture the proven experience of software architectures in the form of architectural patterns, each with distant properties that address different architectural design patterns.

7.Write about SOAP message structure

The SOAP Envelop: the outermost element of a SOAP message. The envelope element is the root of the XML document that defines a SOAP message.

The SOAP Header: An optional,yet key element in architects a distributed systems around

XML.

The SOAP Body: An element that must appear in a SOAP message

8.What is SOAP message

· SOAP message have a common format that includes a SOAP envelop.an optional header and a body section that contains the message content.

· SOAP message defines one way data transmission from a sender to receiver.

9. What are the parts of SOAP

SOAP consists of three parts

1. Encoding rules that control XML tags that define a SOAP message and framework that describes message content.

2. Rules for exchanging application

3. Conversions for representing remote procedure calls and response.


UNIT V WEB SERVICES

1. Define web services

Web services is a set of protocols that builds on the global connectivity made possible by SOAP and the synergies of XML and HTTP.It is the important approach to software discovery and it is decentralized, loosely coupled.

2. What are the key technologies in web services

The three key technologies are

1.UDDI

2. WSDL

3. SOAP

3. Define ebXML

· Electronic Business XML (ebXML) represents a global initiative to define process around which business can interact over the web.

· It includes multiple specifications it define standard ways of exchanging business messages, conducting trading relationships etc.

4. Define UDDI

UDDI- Universal Description Discovery and Integration.

A protocol for describing web services components. UDDI allows business to register with an internet directory so they can advertise their services and companies can find each other and carry out transactions over the web.

5. Define WSDL.

WSDL- Web Service Description Language

An XML description of both the service interface and the implementation details of how to connect to and user particular web service.

6. What is mean by firewall

A firewall is a piece of network hardware that serves as a secure gate way between an internal network and internet.

Its protect the internal network from unauthorized access or activity.

7. Write a note on proxy server

A proxy server is a host that makes internet request on behalf of other machines on the network, Proxy servers are often used to catch frequently requested files or tomonitor internet use within a corporation.

CS55- PROGRAMMING PARADIGMS Questions Bank 2014

Anna University, Chennai

Anna_University,_Chennai_logo

Part-B

1. Explain about Static Members with examples.

2. Explain the methods available under String and String Buffer Class.

3. Explain Packages and Java Doc Comments in detail.

4. Explain about Arrays

Part-B

1. Explain event handling with examples.

2. Explain about Model-View-Controller pattern .

3. Explain about adapter classes with examples.

Part-B

1. Explain about Generic Classes and Methods

2. Explain exception hierarchy.

Part-B

1. What is a thread? Explain its states and methods?

2. Explain thread properties.

3. Explain about Executors and Synchronizers.

4. Explain in detail about Synchronization.

3. Explain about Inheritance rules for generics.

4. Explain about Assertions and Logging.

CS2304-SYSTEM SOFTWARE Two Marks Questions With Answers 2014

 

Anna University, Chennai

Anna_University,_Chennai_logo

SRINIVASAN ENGINEERING COLLEGE, PERAMBALUR

CS2304-SYSTEM SOFTWARE

16 Marks

1. Describe the architecture of SIC machine.

2. Describe SIC/EX machine architecture.

3. Discuss about any one of the RISC machine architecture.

4. Discuss about any one of the RISC machine architecture.

16 Marks

1. Explain the design of a loader.

2. Discuss about the absolute loader.

3. What is meant by automatic library search?

4. Explain about bootstrap loader.

clip_image008[4]5. Explain the functions of program linking in machine dependent loader.

16 Marks

1. Explain in detail about Macro processor algorithm and data structures.

2. Explain the following machine independent macro features.

a. Concatenation of macro parameters

b. Keyword macro parameters

3. Explain in detail about MASM macro processor.

4. Explain ANSI C macro processor.

5. Explain conditional macro expansion with different types of macro conditional statements.

6. i) Why should a macro processor generate unique labels and explain how unique labels are generated.

clip_image010[4]ii) Discuss in brief about the data structures used by a macro processor.

16 Marks

1. Explain the Editor structure with a neat diagram.

2. Write short notes on

a. Interactive debugging systems

b. Text editors

3. Write short notes on

a. User Interface Criteria

b. Features that a basic text editor should posses

4. Explain debugging functions and its capabilities.

5. i) How are user interfaces useful? Explain

ii) Discuss the nature of user interface for an interactive debugger.

6. Discuss in detail about Interactive debugging systems

CS55- PROGRAMMING PARADIGMS Questions Bank 2014

Anna University, Chennai

Anna_University,_Chennai_logo

SRINIVASAN ENGINEERING COLLEGE, PERAMBALUR

CS55- PROGRAMMING PARADIGMS

Part-B

1. Explain about Inheritance.

2. Explain about Polymorphism.

3. Explain about Object Cloning with examples.

4. Explain about Reflection with examples.

Part-B

1. Explain event handling with examples.

2. Explain about Model-View-Controller pattern .

3. Explain about adapter classes with examples.

Part-B

1. Explain about Generic Classes and Methods

2. Explain exception hierarchy.

3. Explain about Inheritance rules for generics.

4. Explain about Assertions and Logging.

Part-B

1. What is a thread? Explain its states and methods?

2. Explain thread properties.

3. Explain about Executors and Synchronizers.

4. Explain in detail about Synchronization.

CS55- PROGRAMMING PARADIGMS Two Mark Questions With Answers 2014

Anna University, Chennai

Anna_University,_Chennai_logo

SRINIVASAN ENGINEERING COLLEGE, PERAMBALUR

CS55- PROGRAMMING PARADIGMS

2-MARK Questions and Answers

UNIT I

OBJECT-ORIENTED PROGRAMMING – FUNDAMENTALS

1) What is meant by Object Oriented Programming?

OOP is a method of programming in which programs are organised as cooperative collections of objects. Each object is an instance of a class and each class belong to a hierarchy.

2) What is a Class?

Class is a template for a set of objects that share a common structure and a common behaviour.

3) What is an Object?

Object is an instance of a class. It has state,behaviour and identity. It is also called as an instance of a class.

4) What is an Instance?

An instance has state, behaviour and identity. The structure and behaviour of similar classes are defined in their common class. An instance is also called as an object.

5) What are the core OOP’s concepts?

Abstraction, Encapsulation, Inheritance and Polymorphism are the core OOP’s

concepts.

6) What is meant by abstraction?

Abstraction defines the essential characteristics of an object that distinguish it from all other of objects. Abstraction provides crisply-defined conceptual boundaries relative to the perspective of the viewer. Its the process of focussing on the essential characteristics of an object. Abstraction is one of the fundamental elements of the object model.

7) What is meant by Encapsulation?

Encapsulation is the process of compartmentalising the elements of an abtraction that defines the structure and behaviour. Encapsulation helps to separate the contractual interface of an abstraction and implementation.

8) What are Encapsulation, Inheritance and Polymorphism?

Encapsulation is the mechanism that binds together code and data it manipulates and

keeps both safe from outside interference and misuse. Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.

9) What are methods and how are they defined?

Methods are functions that operate on instances of classes in which they are defined. Objects can communicate with each other using methods and can call methods in other classes. Method definition has four parts. They are name of the method, type of object or primitive type the method returns, a list of parameters and the body of the method. A method’s signature is a combination of the first three parts mentioned above.

10) What are different types of access modifiers (Access specifiers)?

Access specifiers are keywords that determine the type of access to the member of a class. These keywords are for allowing privileges to parts of a program such as functions and variables. These are: public: Anything declared as public can be accessed from anywhere. private: Any thing declared as private can’t be seen outside of its class. protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other package default modifier : Can be accessed only to classes in the same package.

11) What is an Object and how do you allocate memory to it?

Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. When an object is created using new operator, memory is allocated to it.

12) Explain the usage of Java packages.

This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.

13) What is method overloading and method overriding?

Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding.

14) What gives java it’s “write once and run anywhere” nature?

All Java programs are compiled into class files that contain bytecodes. These byte codes can be run in any platform and hence java is said to be platform independent.

15) What is a constructor? What is a destructor?

Constructor is an operation that creates an object and/or initialises its state. Destructor is an operation that frees the state of an object and/or destroys the object itself. In Java, there is no concept of destructors. Its taken care by the JVM.

16) What is the difference between constructor and method?

Constructor will be automatically invoked when an object is created whereas method has to be called explicitly

17) What is Static member classes?

A static member class is a static member of a class. Like any other static method, a static member class has access to all static methods of the parent, or top-level, class.

18) What is Garbage Collection and how to call it explicitly?

When an object is no longer referred to by any variable, java automatically reclaims memory used by that object. This is known as garbage collection. System. gc() method may be used to call it explicitly

19) In Java, How to make an object completely encapsulated?

All the instance variables should be declared as private and public getter and setter methods should be provided for accessing the instance variables.

20) What is static variable and static method?

static variable is a class variable which value remains constant for the entire class static method is the one which can be called with the class itself and can hold only the staic variables

21) What is finalize() method?

finalize () method is used just before an object is destroyed and can be called just prior to garbage collection.

22) What is the difference between String and String Buffer?

a) String objects are constants and immutable whereas StringBuffer objects are not. b) String class supports constant strings whereas StringBuffer class supports growable and modifiable strings.

23) What is the difference between Array and vector?

Array is a set of related data type and static whereas vector is a growable array of objects and dynamic

24) What is a package?

A package is a collection of classes and interfaces that provides a high-level layer of access protection and name space management.

25) What is the difference between this() and super()?

this() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor.

26) Explain working of Java Virtual Machine (JVM)?

JVM is an abstract computing machine like any other real computing machine

which first converts .java file into .class file by using Compiler (.class is nothing but byte code file.) and Interpreter reads byte codes.


UNIT II

OBJECT-ORIENTED PROGRAMMING – INHERITANCE

1) What is meant by Inheritance?

Inheritance is a relationship among classes, wherein one class shares the structure or behaviour defined in another class. This is called Single Inheritance. If a class shares the structure or behaviour from multiple classes, then it is called Multiple Inheritance. Inheritance defines “is-a” hierarchy among classes in which one subclass inherits from one or more generalised superclasses.

2) What is meant by Inheritance and what are its advantages?

Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses.

3) What is the difference between superclass and subclass?

A super class is a class that is inherited whereas sub class is a class that does the inheriting.

4) Differentiate between a Class and an Object?

The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfaces that are loaded by a Java program. The Class class is used to obtain information about an object's design. A Class is only a definition or prototype of real life object. Whereas an object is an instance or living representation of real life object. Every object belongs to a class and every class contains one or more related objects.

5) What is meant by Binding?

Binding denotes association of a name with a class

6) What is meant by Polymorphism?

Polymorphism literally means taking more than one form. Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class.

7) What is Dynamic Binding?

Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run-time. It is associated with polymorphism and inheritance.

8) What is final modifier?

The final modifier keyword makes that the programmer cannot change the value anymore. The actual meaning depends on whether it is applied to a class, a variable, or a

method.

final Classes- A final class cannot have subclasses.

final Variables- A final variable cannot be changed once it is initialized.

final Methods- A final method cannot be overridden by subclasses.

9) What is an Abstract Class?

Abstract class is a class that has no instances. An abstract class is written with the expectation that its concrete subclasses will add to its structure and behaviour, typically by implementing its abstract operations.

10) What are inner class and anonymous class?

Inner class: classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. Anonymous class: Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors

11) What is an Interface?

Interface is an outside view of a class or object which emphaizes its abstraction while hiding its structure and secrets of its behaviour.

12) What is a base class?

Base class is the most generalised class in a class structure. Most applications have such root classes. In Java, Object is the base class for all classes.

13) What is reflection in java?

Reflection allows Java code to discover information about the fields, methods and constructors of loaded classes and to dynamically invoke them.

14) Define superclass and subclass?

Superclass is a class from which another class inherits. Subclass is a class that inherits from one or more classes.

15) What is meant by Binding, Static binding, Dynamic binding?

Binding: Binding denotes association of a name with a class. Static binding: Static binding is a binding in which the class association is made during compile time. This is also called as Early binding. Dynamic binding: Dynamic binding is a binding in which the class association is not made until the object is created at execution time. It is also called as Late binding.

16) What is reflection API? How are they implemented?

Reflection is the process of introspecting the features and state of a class at runtime and dynamically manipulate at run time. This is supported using Reflection API with built-in classes like Class, Method, Fields, Constructors etc. Example: Using Java Reflection API we can get the class name, by using the getName method.

17) What is the difference between a static and a non-static inner class?

A non-static inner class may have object instances that are associated with instances of the class's outer class. A static inner class does not have any object instances.

18) What is the difference between abstract class and interface?

a) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract.

b) In abstract class, key word abstract must be used for the methods whereas interface we need not use that keyword for the methods.

c) Abstract class must have subclasses whereas interface can’t have subclasses.

19) Can you have an inner class inside a method and what variables can you access?

Yes, we can have an inner class inside a method and final variables can be accessed.

20) What is interface and its use?

Interface is similar to a class which may contain method’s signature only but not bodies and it is a formal set of method and constant declarations that must be defined by the class that implements it. Interfaces are useful for:

a) Declaring methods that one or more classes are expected to implement

b) Capturing similarities between unrelated classes without forcing a class relationship. c) Determining an object’s programming interface without revealing the actual body of the class.

21) How is polymorphism acheived in java?

Inheritance, Overloading and Overriding are used to acheive Polymorphism in java.

22) What modifiers may be used with top-level class?

public, abstract and final can be used for top-level class.

23) What is a cloneable interface and how many methods does it contain?

It is not having any method because it is a TAGGED or MARKER interface.

24) What are the methods provided by the object class?

The Object class provides five methods that are critical when writing multithreaded Java programs:

· notify

· notifyAll

· wait (three versions)

25) Define: Dynamic proxy. A dynamic proxy is a class that implements a list of interfaces, which you specify at runtime when you create the proxy. To create a proxy, use the static method java.lang.reflect.Proxy::newProxyInstance(). This method takes three arguments:

· The class loader to define the proxy class

· An invocation handler to intercept and handle method calls

· A list of interfaces that the proxy instance implements

26) What is object cloning?

It is the process of duplicating an object so that two identical objects will exist in the memory at the same time.


UNIT III

EVENT-DRIVEN PROGRAMMING

1) What is the relationship between the Canvas class and the Graphics class?

A Canvas object provides access to a Graphics object via its paint() method.

2) How would you create a button with rounded edges?

There’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it.

3) What is the difference between the ‘Font’ and ‘FontMetrics’ class?

The Font Class is used to render ‘glyphs’ - the characters you see on the screen. FontMetrics encapsulates information about a specific font on a specific Graphics object. (width of the characters, ascent, descent)

4) What is the difference between the paint() and repaint() methods?

The paint() method supports painting via a Graphics object. The repaint()

method is used to cause paint() to be invoked by the AWT painting thread.

5) Which containers use a border Layout as their default layout?

The window, Frame and Dialog classes use a border layout as their default layout.

6) What is the difference between applications and applets?

a)Application must be run on local machine whereas applet needs no explicit installation on local machine.

b)Application must be run explicitly within a java-compatible virtual machine whereas applet loads and runs itself automatically in a java-enabled browser.

c)Application starts execution with its main method whereas applet starts execution with its init method.

d)Application can run with or without graphical user interface whereas applet must run within a graphical user interface.

7) Difference between Swing and Awt?

AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.

8) What is a layout manager and what are different types of layout managers available in java AWT?

A layout manager is an object that is used to organize components in a container. The different layouts are available are FlowLayout, BorderLayout, CardLayout, GridLayout and GridBagLayout.

9) How are the elements of different layouts organized?

FlowLayout: The elements of a FlowLayout are organized in a top to bottom, left to right fashion.

BorderLayout: The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container.

CardLayout: The elements of a CardLayout are stacked, on top of the other, like a deck of cards.

GridLayout: The elements of a GridLayout are of equal size and are laid out using the square of a grid.

GridBagLayout: The elements of a GridBagLayout are organized according to a grid. However, the elements are of different size and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.

The default Layout Manager of Panel and Panel sub classes is FlowLayout.

10) Why would you use SwingUtilities.invokeAndWait or SwingUtilities.invokeLater?

I want to update a Swing component but I’m not in a callback. If I want the update to happen immediately (perhaps for a progress bar component) then I’d use invokeAndWait. If I don’t care when the update occurs, I’d use invokeLater.

11) What is an event and what are the models available for event handling?

An event is an event object that describes a state of change in a source. In other words, event occurs when an action is generated, like pressing button, clicking mouse, selecting a list, etc. There are two types of models for handling events and they are: a) event- inheritance model and b) event-delegation model

12) What is the difference between scrollbar and scrollpane?

A Scrollbar is a Component, but not a Container whereas Scrollpane is a

Conatiner and handles its own events and perform its own scrolling.

13) Why won’t the JVM terminate when I close all the application windows?

The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM.

14) What is meant by controls and what are different types of controls in AWT? Controls are components that allow a user to interact with your application and the AWT supports the following types of controls: Labels, Push Buttons, Check Boxes, Choice Lists, Lists, Scrollbars, and Text Components. These controls are subclasses of Component.

15) What is the difference between a Choice and a List?

A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.

16) What is the purpose of the enableEvents() method?

The enableEvents() method is used to enable an event for a particular object. Normally,an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their eventdispatch methods.

17) What is the difference between the File and RandomAccessFile classes?

The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.

18) What is the lifecycle of an applet?

init() method - Can be called when an applet is first loaded start() method - Can be called each time an applet is started. paint() method - Can be called when the applet is minimized or maximized. stop() method - Can be used when the browser moves off the applet’s page. destroy() method - Can be called when the browser is finished with the applet.

19) What is the difference between a MenuItem and a CheckboxMenuItem?

The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.

20) What class is the top of the AWT event hierarchy?

The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy.

21) What is source and listener?

source : A source is an object that generates an event. This occurs when the internal state of that object changes in some way.

listener : A listener is an object that is notified when an event occurs. It has two major requirements. First, it must have been registered with one or more sources to receive notifications about specific types of events. Second, it must implement methods to receive and process these notifications.

22) Explain how to render an HTML page using only Swing.

Use a JEditorPane or JTextPane and set it with an HTMLEditorKit, then load the text into the pane.

23) How would you detect a keypress in a JComboBox?

This is a trick. most people would say ‘add a KeyListener to the JComboBox’ -

but the right answer is ‘add a KeyListener to the JComboBox’s editor component.’

24) What an I/O filter?

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

25) How can I create my own GUI components?

Custom graphical components can be created by producing a class that inherits from java.awt.Canvas. Your component should override the paint method, just like an applet does, to provide the graphical features of the component.


UNIT IV

GENERIC PROGRAMMING

1) What is an exception?

An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.

2) What is error?

An Error indicates that a non-recoverable condition has occurred that should not be caught. Error, a subclass of Throwable, is intended for drastic problems, such as OutOfMemoryError, which would be reported by the JVM itself.

3) Which is superclass of Exception?

"Throwable", the parent class of all exception related classes.

4) What are the advantages of using exception handling?

Exception handling provides the following advantages over "traditional" error management techniques:

Separating Error Handling Code from "Regular" Code. Propagating Errors Up the Call Stack.

Grouping Error Types and Error Differentiation.

5) What are the types of Exceptions in Java

There are two types of exceptions in Java, unchecked exceptions and checked exceptions.

Checked exceptions: A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Each method must either handle all checked exceptions by supplying a catch clause or list each unhandled checked exception as a thrown exception.

Unchecked exceptions: All Exceptions that extend the RuntimeException class are unchecked exceptions. Class Error and its subclasses also are unchecked.

6) Why Errors are Not Checked?

A unchecked exception classes which are the error classes (Error and its subclasses) are exempted from compile-time checking because they can occur at many points in the program and recovery from them is difficult or impossible. A program declaring such exceptions would be pointlessly.

7) How does a try statement determine which catch clause should be used to handle an exception?

When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.

8) What is the purpose of the finally clause of a try-catch-finally statement?

The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.

9) What is the difference between checked and Unchecked Exceptions in Java?

All predefined exceptions in Java are either a checked exception or an unchecked exception. Checked exceptions must be caught using try.. catch () block or we should throw the exception using throws clause. If you dont, compilation of program will fail.

10) What is the difference between exception and error?

The exception class defines mild error conditions that your program encounters. Exceptions can occur when trying to open the file, which does not exist, the network connection is disrupted, operands being manipulated are out of prescribed ranges, the class file you are interested in loading is missing. The error class defines serious error conditions that you should not attempt to recover from. In most cases it is advisable to let the program terminate when such an error is encountered.

11) What is the catch or declare rule for method declarations?

If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.

12) When is the finally clause of a try-catch-finally statement executed?

The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.

13) What if there is a break or return statement in try block followed by finally block?

If there is a return statement in the try block, the finally block executes right after the return statement encountered, and before the return executes.

14) What are the different ways to handle exceptions?

There are two ways to handle exceptions:

Wrapping the desired code in a try block followed by a catch block to catch the exceptions.

List the desired exceptions in the throws clause of the method and let the caller of the method handle those exceptions.

15) How to create custom exceptions?

By extending the Exception class or one of its subclasses. Example:

class MyException extends Exception {

public MyException() { super(); }

public MyException(String s) { super(s); }

}

16) Can we have the try block without catch block?

Yes, we can have the try block without catch block, but finally block should follow the try block.

Note: It is not valid to use a try clause without either a catch clause or a finally clause.

17) What is the difference between swing and applet?

Swing is a light weight component whereas Applet is a heavy weight Component. Applet does not require main method, instead it needs init method.

18) What is the use of assert keyword?

Assert keyword validates certain expressions. It replaces the if block effectively and throws an AssertionError on failure. The assert keyword should be used only for critical arguments (means without that the method does nothing).

19) How does finally block differ from finalize() method?

Finally block will be executed whether or not an exception is thrown. So it is used to free resoources. finalize() is a protected method in the Object class which is called by the JVM just before an object is garbage collected.

20) What is the difference between throw and throws clause?

throw is used to throw an exception manually, where as throws is used in the case of checked exceptions, to tell the compiler that we haven't handled the exception, so that the exception will be handled by the calling function.

21) What are the different ways to generate and Exception?

There are two different ways to generate an Exception.

1. Exceptions can be generated by the Java run-time system.

Exceptions thrown by Java relate to fundamental errors that violate the rules of the Java language or the constraints of the Java execution environment.

2. Exceptions can be manually generated by your code.

Manually generated exceptions are typically used to report some error condition to the caller of a method.

22) Where does Exception stand in the Java tree hierarchy?

· java.lang.Object

· java.lang.Throwable

· java.lang.Exception

· java.lang.Error

23) What is StackOverflowError?

The StackOverFlowError is an Error Object thorwn by the Runtime System when it Encounters that your application/code has ran out of the memory. It may occur in case of recursive methods or a large amount of data is fetched from the server and stored in some object. This error is generated by JVM.

e.g. void swap(){

swap();

}

24) Explain the exception hierarchy in java.

The hierarchy is as follows: Throwable is a parent class off all Exception classes. They are two types of Exceptions: Checked exceptions and UncheckedExceptions. Both type of exceptions extends Exception class

25) How do you get the descriptive information about the Exception occurred during the program execution?

All the exceptions inherit a method printStackTrace() from the Throwable class. This method prints the stack trace from where the exception occurred. It prints the most recently entered method first and continues down, printing the name of each method as it works its way down the call stack from the top.


UNIT V CONCURRENT PROGRAMMING

1) Explain different way of using thread?

The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance.

2) What are the different states of a thread ?

The different thread states are ready, running, waiting and dead.

3) Why are there separate wait and sleep methods?

The static Thread.sleep(long) method maintains control of thread execution but delays the next action until the sleep time expires. The wait method gives up control over thread execution indefinitely so that other threads can run.

4) What is multithreading and what are the methods for inter-thread communication and what is the class in which these methods are defined?

Multithreading is the mechanism in which more than one thread run independent of each other within the process. wait (), notify () and notifyAll() methods can be used for inter-thread communication and these methods are in Object class. wait() : When a thread executes a call to wait() method, it surrenders the object lock and enters into a waiting state. notify() or notifyAll() : To remove a thread from the waiting state, some other thread must make a call to notify() or notifyAll() method on the same object.

5) What is synchronization and why is it important?

With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.

6) How does multithreading take place on a computer with a single CPU?

The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

7) What is the difference between process and thread?

Process is a program in execution whereas thread is a separate path of execution in a program.

8) What happens when you invoke a thread's interrupt method while it is sleeping or waiting?

When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.

9) How can we create a thread?

A thread can be created by extending Thread class or by implementing Runnable interface. Then we need to override the method public void run().

10) What are three ways in which a thread can enter the waiting state?

A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

11) How can i tell what state a thread is in ?

Prior to Java 5, isAlive() was commonly used to test a threads state. If isAlive() returned false the thread was either new or terminated but there was simply no way to differentiate between the two.

12) What is synchronized keyword? In what situations you will Use it?

Synchronization is the act of serializing access to critical sections of code. We will use this keyword when we expect multiple threads to access/modify the same data. To understand synchronization we need to look into thread execution manner.

13) What is serialization?

Serialization is the process of writing complete state of java object into output stream, that stream can be file or byte array or stream associated with TCP/IP socket.

14) What does the Serializable interface do?

Serializable is a tagging interface; it prescribes no methods. It serves to assign the Serializable data type to the tagged class and to identify the class as one which the developer has designed for persistence. ObjectOutputStream serializes only those objects which implement this interface.

15) When you will synchronize a piece of your code?

When you expect your code will be accessed by different threads and these threads may change a particular data causing data corruption.

16) What is daemon thread and which method is used to create the daemon thread?

Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system. setDaemon method is used to create a daemon thread.

17) What is the difference between yielding and sleeping?

When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.

18) What is casting?

There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert

larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.

19) What classes of exceptions may be thrown by a throw statement?

A throw statement may throw any expression that may be assigned to the

Throwable type.

20) A Thread is runnable, how does that work?

The Thread class' run method normally invokes the run method of the Runnable type it is passed in its constructor. However, it is possible to override the thread's run method with your own.

21) Can I implement my own start() method?

The Thread start() method is not marked final, but should not be overridden. This method contains the code that creates a new executable thread and is very specialised. Your threaded application should either pass a Runnable type to a new Thread, or extend Thread and override the run() method.

22) Do I need to use synchronized on setValue(int)?

It depends whether the method affects method local variables, class static or instance variables. If only method local variables are changed, the value is said to be confined by the method and is not prone to threading issues.

23) What is thread priority?

Thread Priority is an integer value that identifies the relative order in which it should be executed with respect to others. The thread priority values ranging from 1- 10 and the default value is 5. But if a thread have higher priority doesn't means that it will execute first. The thread scheduling depends on the OS.

24) What are the different ways in which a thread can enter into waiting state?

There are three ways for a thread to enter into waiting state. By invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method.

25) How would you implement a thread pool?

The ThreadPool class is a generic implementation of a thread pool, which takes the following input Size of the pool to be constructed and name of the class which implements Runnable (which has a visible default constructor) and constructs a thread pool with active threads that are waiting for activation. once the threads have finished processing they come back and wait once again in the pool.

26) What is a thread group?

A thread group is a data structure that controls the state of collection of thread as a whole managed by the particular runtime environment.

CS2304-SYSTEM SOFTWARE Two Marks Questions With Answers 2014

Anna University, Chennai

Anna_University,_Chennai_logo 

SRINIVASAN ENGINEERING COLLEGE, PERAMBALUR

CS2304-SYSTEM SOFTWARE

2MARKS

UNIT I-INTRODUCTION

1. Define system software.

It consists of variety of programs that supports the operation of the computer. This software makes it possible for the user to focus on the other problems to be solved with out needing to know how the machine works internally.

Eg: operating system, assembler, loader.

2. Give some applications of OS.

-to make the computer easier to use

-to manage the resources in computer

-process management

-data and memory management

-to provide security to the user.

Operating system acts as an interface between the user and the system

Eg:windows,linux,unix,dos

3. Define compiler and interpreter.

Compiler is a set of program which converts the whole high level language program to machine language program.

Interpreter is a set of programs which converts high level language program to machine language program line by line.

4. Define loader.

Loader is a set of program that loads the machine language translated by the translator into the main memory and makes it ready for execution.

5. What is the need of MAR register.

MAR (memory address register) is used to store the address of the memory from which the data is to be read or to which the data is to be written.

6. Draw SS instruction format.

0 7 8 15 16 19 20 31 32 35 36 47

It is a 6 byte instruction used to move L+I bytes data fro the storage location 1 to the storage location2.

Storage location1 = D1+[B1] Storage location2 = D2+[B2] Eg: MOV 60,400(3),500(4)

Base relative addressing

PC relative addressing

aTarget address is calculated using the formula

Target address =

cement+ [B]

Here The target address is calculated using the formula

Target address = Displacement + [PC]

PC-program counter

B-base register

7. Give any two difference between base relative addressing and program counter relative addressing used in SIC/XE.

Displa

Displacement lies between 0 to 4095 Displacement lies between –2048 to 2047

8. Define indirect addressing.

In the case of immediate addressing the operand field gives the memory location.The word from the given address is fetched and it gives the address of the operand.

Eg:ADD R5, [600]

Here the second operand is given in indirect addressing mode.First the word in memory location 600 is fetched and which will give the address of the operand.

9. Define immediate addressing.

In this addressing mode the operand value is given directly.There is no need to refer memory.The immediate addressing is indicated by the prefix „#‟.

Eg: ADD #5

In this instruction one operand is in accumulator and the second operand is a immediate value the value 5 is directly added with the accumulator content and the result is stored in accumulator.

10. List out any two CISC and RISC.

machine. CISC –Power PC, Cray T3E

RISC – VAX,Pentium Pro architecture

11. Following is a memory configuration:

Address Value Register R

1 5 5

5 7

6 5

What is the result of the following statement?

ADD 6(immediate) to R (indirect)

clip_image002Here 6 is the immediate data and the next value is indirect data.ie the register contains the address of the operand. Here the address of the operand is 5 and its corresponding value is 7. 6

+ [R] = 6+ [5] = 6+ 7 =13

Address

Value

Register R

4

9

6

5

7

 

6

2

 
12. Following is a memory configuration:

What is the result of the following statement? SUB 4(direct) to R (direct)

Here one operand is in the address location 4(direct addressing) and the next operand is in the register(register direct).

The resultant value is 9 –6 =3.

13. What is the name of X and L register in SIC machine and also specify its use.

A-accumulator

clip_image003Used for arithmetic operation.ie in the case of arithmetic operations one operand is in the accumulator,and other operand may be a immediate value,registre operand or memory content.The operation given in the instruction is performed and the result is stored in the accumulator register.

L-linkage register

It is used to store the return address in the case of jump to subroutine (JSUB) instructions.

14. What are the instruction formats used in SIC/XE architecture? Give any one format. Format 1 (1 byte), Format 2 (2 bytes), Format 3 (3 bytes) & Format 4(4 bytes) Are the different instructions used in SIC/XE architecture.

Format 2:

8

4

4

 
 

OPCODE

R1

R2

15. Consider the instructions in SIC/ XE programming.

10

1000

LENGTH

RESW 4

20

-----

NEW

WORD 3

What is the value assign to the symbol NEW.

In the line 10 the address is 1000 and the instruction is RESW 4.It reserves 4 word (3 x 4

=12) area for the symbol LENGTH.hence 12 is added to the LOCCTR.

Thus the value of the symbol NEW is 1000+12 =100C.

16. What is the difference between the instructions LDA # 3 and LDA THREE?

In the first instruction immediate addressing is used. Here the value 3 is directly loaded into the accumulator register.

In the second instruction the memory reference is used. Here the address (address assigned for the symbol THREE) is loaded into the accumulator register.

17. Differentiate trailing numeric and leading separate numeric.

The numeric format is used to represent numeric values with one digit per byte. In the numeric format if the sign appears in the last byte it is known as the trailing numeric. If the sign appears in a separate byte preceding the first digit then it is called as leading separate numeric.

18. What are the addressing modes used in VAX architecture?

Register direct, register deferred, auto increment and decrement, program counter relative, base

relative, index register mode and indirect addressing are the various addressing modes in VAX

architecture.

19. How do you calculate the actual address in the case of register indirect with immediate index mode?

Here the target address is calculated using the formula

T.A =(register) + displacement.

20. Write the sequence of instructions to perform the operation BETA = ALPHA + 1 using

SIC instructions.

LDA

A D D S T A

….

R E S W

ALPHA

ONE BETA

….

ALPHA 1

RESW

BETA 1

RESW

ONE 1

21. Write the sequence of instructions to perform the operation BETA = ALPHA+5 using SIC/XE instructions.

LDA ALPHA ADD STA

…. ALPHA RESW BETA RESW

22. What is the use of TD instruction in SIC architecture?

The test device (TD) instruction tests whether the addressed device is ready to send or receive a byte of data.The condition code is set to indicate the result of this test. Setting of < means the device is ready to send or receive, and = means the device is not ready.


UNIT II-ASSEMBLERS

2 Marks

1. Define the basic functions of assembler.

*translating mnemonic operation codes to their machine language equivalents.

*Assigning machine addresses to symbolic labels used by the programmer.

2. What is meant by assembler directives. Give example.

These are the statements that are not translated into machine instructions,but they provide instructions to assembler itself.

example START,END,BYTE,WORD,RESW and RESB.

3 .What is forward references?

It is a reference to a label that is defined later in a program.

Consider the statement

10 1000 STL RETADR

80 1036 RETADR RESW 1

The first instruction contains a forward reference RETADR.If we attempt to translate the program line by line,we will unable to process the statement in line 10 because we do not know the address that will be assigned to RETADR .The address is assigned later(in line 80) in the program.

4.What are the three different records used in object program?

The header record,text record and the end record are the three different records used in object program.

The header record contains the program name,starting address and length of the program. Text record contains the translated instructions and data of the program.

End record marks the end of the object program and specifies the address in the program where execution is to begin.

5.What is the need of SYMTAB(symbol table) in assembler?

The symbol table includes the name and value for each symbol in the source program,together with flags to indicate error conditions.Some times it may contains details about the data area. SYMTAB is usually organized as a hash table for efficiency of insertion and retrieval.

6. What is the need of OPTAB(operation code table) in assembler?

The operation code table contain the mnemonic operation code and its machine language equivalent. Some assemblers it may also contains information about instruction format and length.OPTAB is usually organized as a hash table,with mnemonic operation code as the key.

7.What are the symbol defining statements generally used in assemblers?

* „EQU‟-it allows the programmer to define symbols and specify their values directly.The general format is symbol EQU value

* „ORG‟-it is used to indirectly assign values to symbols.When this statement is encountered the assembler resets its location counter to the specified value.

The general format is ORG

value

In the above two statements value is a constant or an expression involving constants and previously defined symbols.

8.Define relocatable program.

An object program that contains the information necessary to perform required modification in the object code depends on the starting location of the program during load time is known as relocatable program.

9.Differentiate absolute expression and relative expression.

If the result of the expression is an absolute value (constant) then it is known as absolute expression.,

Eg : BUFEND – BUFFER

If the result of the expression is relative to the beginning of the program then it is known as relative expression.label on instructions and data areas and references to the location counter values are relative terms.

Eg: BUFEND + BUFFER

10. Write the steps required to translate the source program to object program.

· Convert mnemonic operation codes to their machine language equivalents. Convert symbolic operands to their equivalent machine addresses

· Build the machine instruction in the proper format.

· Convert the data constants specified in the source program into their internal machine representation

· Write the object program and assembly listing.

11 .What is the use of the variable LOCCTR(location counter) in assembler?

This variable is used to assign addresses to the symbols.LOCCTR is initialized to the beginning address specified in the START statement.Aftre each source statement is processed the length of the assembled instruction or data area to be generated is added to LOCCTR and hence whenever we reach a label in the source program the current value of LOCCTR gives the address associated with the label.

12. Define load and go assembler.

One pass assembler that generate their object code in memory for immediate execution is known as load and go assembler.Here no object programmer is written out and hence no need for loader.

13 .What are the two different types of jump statements used in MASM

assembler.

Near jump

A near jump is a jump to a target in the same segment and it is assembled by using a current code segment CS.

Far jump

A far jump is a jump to a target in a different code segment and it is assembled by using different segment registers .

14.What are the use of base register table in AIX assembler?

A base register table is used to remember which of the general purpose registers are currently available as base registers and also the base addresses they contain.

.USING statement causes entry to the table and .DROP statement removes the corresponding table entry.

15. Differentiate the assembler directives RESW and RESB.

RESW –It reserves the indicated number of words for data area. Eg:

10 1003 THREE RESW 1

In this instruction one word area(3 bytes) is reserved for the symbol THREE. If the memory is byte addressable then the address assigned for the next symbol is 1006.

RESB –It reserves the indicated number of bytes for data area. Eg: 10 1008 INPUT RESB 1

In this instruction one byte area is reserved for the symbol INPUT .Hence the address assigned for the next symbol is 1009.

1 6.Define modification record and give its format

This record contains the information about the modification in the object code during program relocation.the general format is

Col 1 M

Col 2-7 starting location of the address field to be modified relative to the beginning of the program

Col 8-9 length of the address field to be modified in half bytes.

17.Write down the pass numbers(PASS 1/ PASS 2) of the following activities that occur in a two pass assembler:

a. Object code generation

b. Literals added to literal table c. Listing printed

d. Address location of local symbols

Answer:

a. Object code generation - PASS 2

b. Literals added to literal table – PASS 1 c. Listing printed – PASS2

d. Address location of local symbols – PASS 1

18. What is meant by machine independent assembler features?

The assembler features that does not depends upon the machine architecture are known as

machine independent assembler features. Eg: program blocks,Literals.

19. How the register to register instructions are translated in assembler?

In the case of register to register instructions the operand field contains the register name.During the translation first the object code is converted into its corresponding machine language equivalent with the help of OPTAB.Then the SYMTAB is searched for the numeric equivalent of register and that value is inserted into the operand field.

Eg: 125 1036 RDREC CLEAR X B410

B4-macine equivalent of the opcode CLEAR

10-numeric equivalent of the register X.

20. What is meant by external references?

Assembler program can be divided into many sections known as control sections and each control section can be loaded and relocated independently of the others.If the instruction in one control section need to refer instruction or data in another control section .the assembler is unable to process these references in normal way.Such references between control are called external references.

21 .Define control section.

A control section is a part of the program that maintain its identity after assembly;each control section can be loaded and relocated independently of the others.

Control sections are most often used for subroutines.The major benefit of using control sections is to increase flexibility.

22.What is the difference between the assembler directive EXTREF and EXTDEF.

EXTDEF names external symbols that are defined in a particular control section

and may be used by other sections.

EXTREF names external symbols that are referred in a particular control section and defined in another control section.

23. Give the general format of define record.

This record gives information about external symbols that are defined in a particular control

section.The format is

Col 1 D

Col 2-7 name of external symbol defined in this control section Col 8-13 relative address of the symbol with in this control section Col 14-73 name and relative address for other external symbols.

24.Give the use of assembler directive CSECT and USE

CSECT - used to divide the program into many control sections

USE – used to divide the program in to many blocks called program blocks

25.What is the use of the assembler directive START.

The assembler directive START gives the name and starting address of the program.The format is PN START 1000

Here PN –name of the program

1000-starting address of the program.

16 Marks

1. Describe the structure of a single pass assembler.

2. Discuss the design aspects of a two pass assembler.

3. Describe the various stages of an assembly process and explain how they are organized in two pass assembler.

4. What is meant by program relocation? Explain.

5. What is conditional assembly? Explain with example.

6. Discuss the merits of multipass assembler.

UNIT III (LOADERS AND LINKERS)

2 Marks

1 .What are the basic functions of loaders.

Loading – brings the object program into memory for execution

Relocation – modifies the object program so that it can be loaded at an address different from the location originally specified

Linking – combines two or more separate object programs and also supplies the information needed to reference them.

2.Define absolute loader

The loader, which is used only for loading, is known as absolute loader. e.g. Bootstrap loader

3.What is meant by bootstrap loader?

This is a special type of absolute loader which loads the first program to be run by the computer. (usually an operating system)

4.What are relative (relocative) loaders?

Loaders that allow for program relocation are called relocating (relocative ) loaders.

5.What is the use of modification record?

Modification record is used for program relocation.Each modification record specifies the starting address and the length of the field whose value is to be altered and also describes the modification to be performed.

6.What are the 2 different techniques used forrelocation?

Modification record method and relocation bit method.

7.Relocation bit method

If the relocation bit corresponding to a word of object code is set to 1,the program‟s starting address is

to be added to this word when the program is relocated.

Bit value 0 indicates no modification is required.

8.Define bit mask

The relocation bits are gathered together following the length indicator in each text record and which is called as bit mask.For e.g. the bit mask FFC(1 11111111100) specifies that the first 10 words of object code are to be modified during relocation.

9.What is the need of ESTAB.

It is used to store the name and address of the each external symbol. It also indicates in which control section the symbol is defined.

10.What is the use of the variable PROGADDR.

It gives the beginning address in memory where the linked program is to be loaded.The starting address is obtained from the operating system.

11 .Write the two passes of a linking loader.

Pass 1: assigns address to all external symbols

Pass2: it performs actual loading, relocation and linking.

1 2.Define automatic library search.

In many linking loaders the subroutines called by the program being loaded are automatically fetched from the library, linked with the main program and loaded.This feature is referred to as automatic library search.

13. List the loader options INCLUDE &DELETE. The general format of INCLUDE is

INCLUDE program_name (library name).This command direct the loader to read the designated object

program from a library and treat it as the primary loader input. The general format of DELETE

command is DELETE Csect-name

It instructs the loader to delete the named control sections from the sets of programs loaded.

14.Give the functions of the linking loader.

The linking loader performs the process of linking and relocation. It includes the operation of automatic library search and the linked programs are directly loaded.

15. Give the difference between linking loader and linkage editors.into the memory.

Linkin

The re

Time g loader editor

the pro location and linking is performed each It produces a linked version of a program and

Here t h

gram is loaded whichis written in a file for later execution e loading can be accomplished in a single Two passes are required

16..Define dynamic linking.

If the subroutine is loaded and linked to the program during its first call(run time),then it is called as dynamic loading or dynamic linking.

1 7.write the advantage of dynamic linking.

a) it has the ability to load the routine only when they are needed

b) The dynamic linking avoids the loading of entire library for each execution

18. What is meant by static executable and dynamic executable?

In static executable, all external symbols are bound and ready to run. In dynamic executables some symbols are bound at run time.

19. What is shared and private data?

The data divided among processing element is called shared data. If the data is not shared among processing elements then it is called private data.

20.Write the absolute loader algm.

Begin

Read Header record

Verify program name and length Read first text record

While record type != „E‟ do

Begin

Moved object code to specified location in memory Read next object program record

End

Jump to address specified in End record


UNIT IV (MACRO PROCESSORS)

2 Marks

1 .Define macro processor.

Macro processor is system software that replaces each macroinstruction with the corresponding

group of source language statements. This is also called as expanding of macros.

2. What do macro expansion statements mean?

These statements give the name of the macroinstruction being invoked and the arguments to be used in expanding the macros. These statements are also known as macro call.

3. What are the directives used in macro definition?

MACRO - it identifies the beginning of the macro definition

MEND - it marks the end of the macro definition

4.What are the data structures used in macro processor?

DEFTAB – the macro definitions are stored in a definition table ie it contains a macro prototype and the statements that make up the macro body.

clip_image009NAMTAB – it is used to store the macro names and it contains two pointers for each macro instruction which indicate the starting and end location of macro definition in DEFTAB.it also serves as an index to DEFTAB

ARGTAB – it is used to store the arguments during the expansion of macro invocations.

5.Define conditional macro expansion.

If the macro is expanded depends upon some conditions in macro definition (depending on the arguments supplied in the macro expansion) then it is called as conditional macro expansion.

6.What is the use of macro time variable?

Macro time variable can be used to store working values during the macro expansion. Any symbol that begins with the character & and then is not a macro instruction parameter is assumed to be a macro time variable.

7.What are the statements used for conditional macro expansion?

IF-ELSE-ENDIF statement

WHILE-ENDW statement

8.What is meant by positional parameters?

If the parameters and arguments were associated with each other according to their positions in the macro prototype and the macro invocation statement, then these parameters in macro definitions are called as positional parameters.

9.Consider the macro definition

#Define DISPLAY(EXPR) Printf(“EXPR = %d\n”,EXPR) Expand the macro instruction DISPLAY (ANS)

Ans.: Printf (“EXPR = %d\n”, ANS)

10.What are known as nested macro call?

The statement in which a macro calls on another macro,is called nested macro call. In the nested macro call, the call is done by outer macro and the macro called is the inner macro.

11. How the macro is processed using two passes? Pass 1: processing of definitions

Pass 2:actual-macro expansion.

12.Give the advantage of line by line processors.

-it avoids the extra pass over the source program during assembling

-it may use some of the utility that can be used by language translators so that can be loaded once.

13.What is meant by line by line processor

This macro processor reads the source program statements, process the statements and then the output lines are passed to the language translators as they are generated, instead of being written in an expanded file.

14. Give the advantages of general-purpose macroprocessors.

*The programmer does not need to learn about a macro facility for each compiler.

*Overall saving in software development cost and a maintenance cost

15.What is meant by general-purpose macro processors?

The macro processors that are not dependent on any particular programming language,but can be used with a variety of different languages are known as general purpose macro processors. Eg.The ELENA macro processor.

16. What are the important factors considered while designing a general purpose macroprocessors?

-comments

-grouping of statements t-okens

-syntax used for macro definitions

17.What is the symbol used to generate unique labels?

$ symbol is used in macro definition to generate unique symbols.Each macro expansion the $

symbol is replaced by $XX,where XX is the alpha numeric character.

1 8.How the nested macro calls are executed?

The execution of nested macro call follows the LIFO rule.In case of nested macro calls the expansion of the latest macro call is completed first.

19.Mention the tasks involved in macro expansion.

x identify the macro calls in the program

the values of formal parameters are identified

x

maintain the values of expansion time variables declared in a macro x

expansion time control flow is organized x

determining the values of sequencing symbols

x

expansion of a model statement is performed

20. How to design the pass structure of a macro assembler?

To design the structure of macro-assembler, the functions of macro preprocessor and the

conventional assembler are merged. After merging, the functions are structured into passes of the

macro assembler.

UNIT V (TEXT EDITORS)

2 Marks

1 .Define interactive editor?

An interactive editor is a computer program that allows a user to create and revise a target document. The term document includes objects such as computer programs, text, equations, tables, diagrams, line art, and photographs any thing that one might find on a printed page.

2. What are the tasks performed in the editing process?

4 tasks

1. select the part of the target document to be viewed and manipulated.

2. Determine how to format this view on-line and how to display it.

3. Specify and execute operations that modify the target document.

4. Update the view appropriately.

3. What are the three categories of editor‟s devices?

1. Text device/ String devices

2. Button device/Choice devices

3. Locator device

4.What is the function performed in editing phase?

In the actual editing phase, the target document is created or altered with a set of operations such as insert, delete, replace, move and copy.

5.Define Locator device?

Locator devices are two-dimensional analog-to-digital converters that position a cursor symbol on the screen by observing the user‟s movement of the device. The most common such devices for editing applications are the mouse and the data tablet.

6.What is the function performed in voice input device?

Voice-input devices, which translate spoken words to their textual equivalents, may prove to be the text input devices of the future. Voice recognizers are currently available for command input on some systems.

7.What are called tokens?

The lexical analyzer tracks the source program one character at a time by making the source program into sequence of atomic units is called tokens.

8.Name some of typical tokens.

Identifiers, keywords, constants, operators and punctuation symbols such as commas and parentheses are typical tokens.

9. What is meant by lexeme?

The character that forms a token is said to be a lexeme.

1 0.Mention the main disadvantage of interpreter.

The main disadvantage of interpreter is that the execution time of interpreted program is slower than

that of a corresponding compiled object program.

11 .What is meant by code optimization?

The code optimization is designed to improve the intermediate code, which helps the object program to run faster and takes less space.

12. What is error handler?

The error handler is used to check if there is an error in the program. If any error, it should warn

the programmer by instructions to proceed from phase to phase.

13 .Name some of text editors.

-line editors

-stream editors

-screen editors

-word processors structure editors

14.What for debug monitors are used?

Debug monitors are used in obtaining information for localization of errors.

15 .Mention the features of word processors.

x moving text from one place to another

x merging of text

x Searching

x word replacement

1 6.What are the phases in performing editing process?

a. Traveling phase b. Filtering phase

c. Formatting phase d. Editing phase

17.Define traveling phase.

The phase specifies the region of interest. Traveling is achieved using operations such as next screenful, bottom, find pattern.

1 8.Filtering phase.

The selection of what is to be viewed and manipulated in given by filtering.

1 9.Editing phase

In this phase, the target document is altered with the set of operations such as insert, delete, replace, move and copy.

20.Define user interface?

User interface is one, which allows the user to communicate with the system in order to perform certain tasks. User interface is generally designed in a computer to make it easier to use.

21 .Define input device?

Input device is an electromechanical device, which accepts data from the outside world and translates them into a form, which the computer can interpret.

22.Define output devices

Output devices the user to view the elements being edited and the results of the editing operations.

23.Define editor structure.

The command language processor accepts input from the users input devices and analyzes the tokens and syntactic structure of the commands.

24.Define interactive debugging systems

An interactive debugging system provides programmers with facilities that aid in the testing and debugging of programs.

1. Debugging functions and capabilities

2. Relationship with other parts of the system

3. User interface criteria.

26. What are the basic types of computing environments used in editors functions? Editor‟s

function in three basic types of computing environments

i.Time sharing

ii.Stand-alone

iii.Distributed

27 .What are the methods in Interaction language of a text editor?

a. Typing –oriented or text command oriented method b. Function key interfaces

c. menu oriented method