Leaser Type Setted by : Biyani College Printing Department
While every effort is taken to avoid errors or omissions in this Publication, any mistake or omission that may have crept in is not intentional. It may be taken note of that neither the publisher nor the author will be responsible for any damage or loss of any kind arising to anyone in any manner on account of such errors and omissions.
Preface
I am glad to present this book, especially designed to serve the needs of the students. The book has been written keeping in mind the general weakness in understanding the fundamental concepts of the topics. The book is self-explanatory and adopts the Teach Yourself style. It is based on question-answer pattern. The language of book is quite easy and understandable based on scientific approach. Any further improvement in the contents of the book by making corrections, omission and inclusion is keen to be achieved based on suggestions from the readers for which the author shall be obliged. I acknowledge special thanks to Mr. Rajeev Biyani, Chairman & Dr. Sanjay Biyani, Director (Acad.) Biyani Group of Colleges, who are the backbones and main concept provider and also have been constant source of motivation throughout this Endeavour. They played an active role in coordinating the various stages of this Endeavour and spearheaded the publishing work. I look forward to receiving valuable suggestions from professors of various educational institutions, other faculty members and students for improvement of the quality of the book. The reader may feel free to send in their comments and suggestions to the under mentioned address. Author
Unit I
Networking
Q. 1: What is topology? Or Definition of Topology Ans: Topology is a method of which the other work stations are connected manually.The most popular topologies are the bus, ring and star topology. Network topology explains the way in which the nodes are connected between each other.
Q. 2 What are the different topologies of network? Ans: The different topologies of network are: bus topology: All devices are connected to a central cable, called the bus or backbone. Bus networks are relatively inexpensive and easy to install for small networks. Ethernet systems use a bus topology. ring topology : All devices are connected to one another in the shape of a closed loop, so that each device is connected directly to two other devices, one on either side of it. Ring topologies are relatively expensive and difficult to install, but they offer high bandwidth and can span large distances. Mesh TopologyMesh Network is a network where all the nodes are connected to each other and is a complete network. In a Mesh Network every node is connected to other nodes on the network through hops. Some are connected through single hops and some may be connected with more than one hope. star topology: All devices are connected to a central hub. Star networks are relatively easy to install and manage, but bottlenecks can occur because all data must pass through the hub. tree topology: A tree topology combines characteristics of linear bus and star topologies. It consists of groups of star-configured workstations connected to a linear bus backbone cable.
Q. 3 What are the advantages and disadvantages of different network topologies? Ans: The advantages and disadvantages of different network topologies Bus Topology Advantages of Bus Topology It is easy to handle and implement. It is best suited for small networks.
Disadvantages of Bus Topology
The cable length is limited. This limits the number of stations that can be connected. This network topology can perform well only for a limited number of nodes.
Ring Topology Advantage of Ring Topology The data being transmitted between two nodes passes through all the intermediate nodes. A central server is not required for the management of this topology.
Disadvantages of Ring Topology The failure of a single node of the network can cause the entire network to fail. The movement or changes made to network nodes affects the performance of the entire network.
Mesh Topology Advantage of Mesh Topology The arrangement of the network nodes is such that it is possible to transmit data from one node to many other nodes at the same time.
Disadvantage of Mesh Topology The arrangement wherein every network node is connected to every other node of the network, many of the connections serve no major purpose. This leads to the redundancy of many of the network connections.
Star Topology Advantages of Star Topology Due to its centralized nature, the topology offers simplicity of operation. It also achieves an isolation of each device in the network.
Disadvantage of Star Topology The network operation depends on the functioning of the central hub. Hence, the failure of the central hub leads to the failure of the entire network.
Tree Topology Advantages: Central hub (repeater) increases the distance a signal can travel between devices. Disadvantages: More cabling is required in a tree than in other topologies (except mesh). Entire network collapse if central Hub fails.
Q.4 : What is the difference between wired and wireless transmission? Ans: Wired Transmission Media uses a "cabling" system that guides the data signals along a specific path. The data signals are bound by the "cabling" system. Guided Media is also known as Bound Media. Cabling is meant in a generic sense in the previous sentences and is not meant to be interpreted as copper wire cabling only. Wireless Transmission Media consists of a means for the data signals to travel but nothing to guide them along a specific path. The data signals are not bound to a cabling media and as such are often called Unbound Media.
Q.5 What are the communication technologies used in network? Ans The communication technologies used in network are: Twisted pair Coaxial cable Optical Fibre Microwave Radiowave Infrared Bluetooth
Q. 6 What is Twisted Pair? Ans Twisted Pair : Twisted pair cable consists of a pair of insulated wires twisted together. It is a cable type used in telecommunication for very long time. Cable twisting helps to reduce noise pickup from outside sources and crosstalk on multi-pair cables.
The most commonly used form of twisted pair is unshielded twisted pair (UTP). It is just two insulated wires twisted together. any data communication cables and normal telephone cables are this type. Shielded twisted pair(STP) differs from UTP in that it has a foil jacket that helps prevent crosstalk and noise from outside source. In data communications there is a cable type called FTP (foil shielded pairs) which consists of four twisted pair inside one common shield (made of aluminium foil).
Q.7 What is Coaxial Cable? Ans Coaxial Cable : Coaxial cable is called "coaxial" because it includes one physical channel that carries the signal surrounded (after a layer of insulation) by another concentric physical channel, both running along the same axis. The outer channel serves as a ground. Many of these cables or pairs of coaxial tubes can be placed in a single outer sheathing and, with repeaters, can carry information for a great distance.
Coaxial cable is the kind of copper cable used by cable TV companies between the community antenna and user homes and businesses. Coaxial cable is sometimes used by telephone companies from their central office to the telephone poles near users. It is also widely installed for use in business and corporation Ethernet and other types of local area network.
Q.8 What is Optical Fibre? Ans Optical Fibre : An optical fiber is made up of the core (carries the light pulses), the cladding (reflects the light pulses back into the core) and the buffer coating (protects the core and cladding from moisture, damage, etc.). Together, all of this creates a fiber optic which can carry up to 10 million messages at any time using light pulses.
Optical fibers are widely used in fiber-optic communications, which permits transmission over longer distances and at higher bandwidths (data rates) than other forms of communications. Fibers are used instead of metal wires because signals travel along them with less loss and are also immune to electromagnetic interference.
Q.9 What is Microwaves? Ans Microwave : Microwaves are electromagnetic waves with wavelengths ranging from as long as one meter to as short as one millimeter, or equivalently, with frequencies between 300 MHz (0.3 GHz) and 300 GHz. An increasing rate of mobile customers, new IP-based services, and growing demands for greater coverage areas have created constant challenges for mobile operators. To effectively meet customer demands while protecting investments
and delivering a rapid profit requires a flexible, cost-effective, and reliable core transport network. Microwave Networks offers a complete line of point-to-point microwave radios to help meet existing network demands while easing the transition to new 3G networks and beyond.
Q.10 What is Radiowaves? Ans Radiowave : Radio waves have the longest wavelengths in the electromagnetic spectrum. These waves can be longer than a football field or as short as a football. Radio waves do more than just bring music to your radio. They also carry signals for your television and cellular phones. Radio Waves
Cellular phones also use radio waves to transmit information. These waves are much smaller that TV and FM radio waves.
Q.11 What is Infrared? Ans Infrared: Infrared light lies between the visible and microwave portions of the electromagnetic spectrum. Infrared light has a range of wavelengths, just like visible light has wavelengths that range from red light to violet. "Near infrared" light is closest in wavelength to visible light and "far infrared" is closer to the microwave region of the electromagnetic spectrum. The longer, far infrared wavelengths are about the size of a pin head and the shorter, near infrared ones are the size of cells, or are microscopic. The Infrared
Satellites like GOES 6 and Landsat 7 look at the Earth. Special sensors, like those aboard the Landsat 7 satellite, record data about the amount of infrared light reflected or emitted from the Earth's surface.
Q.12 What is Bluetooth? Ans Bluetooth : Bluetooth is an open wireless technology standard for exchanging data over short distances (using short length radio waves) from fixed and mobile devices, creating personal area networks (PANs) with high levels of security. Bluetooth uses a radio technology called frequency-hopping spread spectrum, which chops up the data being sent and transmits chunks of it on up to 79 bands of 1 MHz width in the range 2402-2480 MHz. This is in the globally unlicensed Industrial, Scientific and Medical (ISM) 2.4 GHz short-range radio frequency band.
Q.13 Name and describe some devices used in network. Ans : Modem: A modem is a device or program that enables a computer to transmit data over, for example, telephone or cable lines. Computer information is stored digitally, whereas information transmitted over telephone lines is transmitted in the form of analog waves. A modem converts between these two forms.
Hub: A common connection point for devices in a network. Hubs are commonly used to connect segments of a LAN. A hub contains multiple ports. When a packet arrives at one port, it is copied to the other ports so that all segments of the LAN can see all packets. A passive hub serves simply as a conduit for the data, enabling it to go from one device (or segment) to another. So-called intelligent hubs include additional features that enables an administrator to monitor the traffic passing through the hub and to configure each port in the hub. Intelligent hubs are also called manageable hubs.
A third type of hub, called a switching hub, actually reads the destination address of each packet and then forwards the packet to the correct port.
Bridges : A bridge device filters data traffic at a network boundary. Bridges reduce the amount of traffic on a LAN by dividing it into two segments. For example, suppose that your network includes both 10BaseT Ethernet and
LocalTalk connections. You can use a bridge to connect these two networks so that they can share information with each other. In addition to connecting networks, bridges perform an additional, important function. They filter information so that network traffic intended for one portion of the network does not congest therest of the network.
Routers: Like bridges, routers connect two or more networks. However, routers are much more powerful than bridges. Routers can filter traffic so that only authorized personnel can enter restricted areas. They can permit or deny network communications with a particular Web site. They can recommend the best route for information to travel. As network traffic changes during the day, routers can redirect information to take less congested routes.
If your school is connected to the Internet, then you will most likely use a router to make that connection. Routers ensure that your local area network traffic remains local, while passing onto the Internet all your electronic mail, Web surfing connections, and other requests for Internet resources. Routers are generally expensive to purchase and difficult to configure and maintain
Repeater : Network repeaters regenerate incoming electrical, wireless or optical signals. With physical media like Ethernet or Wi-Fi, data transmissions can only span a limited distance before the quality of the signal degrades. Repeaters attempt to preserve signal integrity and extend the distance over which data can
safely travel. Example : In satellite wireless, a repeater (more frequently called a transponder) receives uplink signals and retransmits them, often on different frequencies, to destination locations. And In a cellular telephone system, a repeater is one of a group of transceivers in a geographic area that collectively serve a system user.
Gateway :A network gateway is an internetworking system capable of joining together two networks that use different base protocols. A network gateway can be implemented completely in software, completely in hardware, or as a combination of both. Depending on the types of protocols they support, network gateways can operate at any level of the OSI model. Because a network gateway, by definition, appears at the edge of a network, related capabilities like firewalls tend to be integrated with it. On home networks, a broadband router typically serves as the network gateway although ordinary computers can also be configured to perform equivalent functions.
Ethernet card : An Ethernet card is one kind of network adapter. These adapters support the Ethernet standard for high-speed network connections via cables. Ethernet cards are sometimes known as network interface cards (NICs).A network interface card (NIC) is a hardware device that handles an interface to a computer network and allows a network-capable device to access that network.
Q.14 What are the different types of addresses for a host in a network? Ans: The MAC address : MAC ADDRESS is a unique value associated with a network adapter. MAC addresses are also known as hardware addresses or physical addresses. They uniquely identify a adapter on a LAN. MAC addresses are 12- digit hexadecimal numbers (48 bits in length). By convention, MAC addresses are usually written in one of the following two formats: MM:MM:MM:SS:SS:SS
MM-MM-MM-SS-SS-SS
The first half of a MAC address contains the ID number of the adapter manufacturer. These IDs are regulated by an Internet standards body (see sidebar). The second half of a MAC address represents the serial number assigned to the adapter by the manufacturer. In the example, 00:A0:C9:14:C8:29 The prefix 00A0C9 indicates the manufacturer is Intel Corporation.
IP Address (Internet Protocol): An IP address is a 32-bit number that identifies each sender or receiver of information that is sent in packets across the Internet. When you request an HTML page or send e-mail, the Internet Protocol part of TCP/IP includes your IP address in the message (actually, in each of the packets if more than one is required) and sends it to the IP address that is obtained by
looking up the domain name in the Uniform Resource Locator you requested or in the e-mail address you're sending a note to. At the other end, the recipient can see the IP address of the Web page requestor or the e-mail sender and can respond by sending another message using the IP address it received.
Domain Name Server(DNS): A DNS server is any computer registered to join the Domain Name System. A DNS server runs special-purpose networking software, features a public IP address, and contains a database of network names and addresses for other Internet hosts. The Domain Name System (DNS) is a standard technology for managing the names of Web sites and other Internet domains. DNS technology allows you to type names into your Web browser like compnetworking.about.com and your computer to automatically find that address on the Internet.
Q.15 What do you mean by Domain Name Resolution? Ans: Domain Name Resolution is the task of converting domain names to their corresponding IP address. This is all done behind the scenes and is rarely noticed by the user. When you enter a domain name in an application that uses the Internet, the application will issue a command to have the operating system convert the domain name into its IP address, and then connect to that IP address to perform whatever operation it is trying to do. The way the operating system resolves the domain name is based upon its configuration. For almost all operating systems the default order for Domain Name resolution is as follows: 1. Hosts File - There is a file called the HOSTS file that you can use to convert domain names to IP addresses. Entries in the HOSTS file override any mappings that would be resolved via a DNS server. 2. Domain Name System - This is the system used on the Internet for converting domain names to their corresponding IP addresses. Your operating system will connect to the DNS server configured on your computer and have that server return to you the IP address for the domain name you queried it with. 3. Netbios - This only applies to Windows machines and will only be used to map names to IP addresses if all previous methods failed. This method will attempt to map the netbios name you are trying to connect to with an IP address.
Q.16 How do you secure your computer system? Or Define a) DOS(Denial of Service) b) Intrusion detection system c) Snooping Ans a) DOS(Denial of Servive) : A denial of service (DoS) attack is an incident in which a user or organization is deprived of the services of a resource they would
normally expect to have. In a distributed denial-of-service, large numbers of compromised systems attack a single target. "denial-of-service" attack is characterized by an explicit attempt by attackers to prevent legitimate users of a service from using that service. Attacks can be directed at any network device, including attacks on routing devices and web, electronic mail, or Domain Name System servers. A DoS attack can be perpetrated in a number of ways. The five basic types of attack are: 1. Consumption of computational resources, such as bandwidth, disk space, or processor time 2. Disruption of configuration information, such as routing information. 3. Disruption of state information, such as unsolicited resetting of TCP sessions. 4. Disruption of physical network components. 5. Obstructing the communication media between the intended users and the victim so that they can no longer communicate adequately.
b) Intrusion detection system : Intrusion detection (ID) is a type of security management system for computers and networks. An ID system gathers and analyzes information from various areas within a computer or a network to identify possible security breaches, which include both intrusions (attacks from outside the organization) and misuse (attacks from within the organization). ID uses vulnerability assessment (sometimes refered to as scanning), which is a technology developed to assess the security of a computer system or network. Intrusion detection functions include: Monitoring and analyzing both user and system activities Analyzing system configurations and vulnerabilities Assessing system and file integrity Ability to recognize patterns typical of attacks Analysis of abnormal activity patterns Tracking user policy violations
c) Snooping : Snooping, in a security context, is unauthorized access to another person's or company's data. The practice is similar to eavesdropping but is not necessarily limited to gaining access to data during its transmission. Snooping can include casual observance of an e-mail that appears on another's computer screen or watching what someone else is typing. More sophisticated snooping uses software programs to remotely monitor activity on a computer or network device. Malicious hackers (crackers) frequently use snooping techniques and equipment such as key loggers to monitor keystrokes, capture passwords and login information, and to intercept e-mail and other private communications and data transmissions. Corporations sometimes snoop on employees legitimately to monitor their use of business computers and track Internet usage; governments may snoop on individuals to collect information and avert crime and terrorism.
Chapter 2 Open Source Technology
Q.1 What is GNU Operating System? Ans GNU is an operating system that offers a set of free open source programs licensed under UNIX. It has many applications and tools that are also provided with the operating system. This allows users online to share all kinds of files with the intention of upgrading and changing the programs by other networked software developers.
However, being an open source program does not mean that the program is free of charge but is free to modify and publish again.
Q.2 What is an OSI? Ans Open source is a development method for software that harnesses the power of distributed peer review and transparency of process. The promise of open source is better quality, higher reliability, more flexibility, lower cost, and an end to predatory vendor lock-in. The Open Source Initiative (OSI) is a non-profit corporation formed to educate about and advocate for the benefits of open source and to build bridges among different constituencies in the open-source community.
Q.3 What do you mean by the term Open Source? Ans: The Open Source Definition is a bill of rights for the computer user. It defines certain rights that a software license must grant you to be certified as Open Source. Those same programmers feel comfortable contributing to Open Source because they are assured of these rights: The right to make copies of the program, and distribute those copies. The right to have access to the software's source code, a necessary preliminary before you can change it. The right to make improvements to the program.
Q.4 What is Freeware? Ans: Freeware is software developed created by volunteers, and distributed for free. Most of the time, freeware is developed by a single programmer. Freeware email clients include Mozilla Mail, Mozilla Thunderbird, Opera Mail (Opera M2), Outlook Express, Apple Mail. (Although the only way to get Outlook Express Windows or Apple Mail is to purchase Microsoft Windows or Mac OS X) Freeware is software offered free of charge, downloadable off of the Internet. If the software requires the user to view ads while using the program, it is technically not freeware but adware. Freeware is also different from shareware in that shareware requires a payment if the software is to be used past a trial date.
Q.5 What is Linux? Ans Linux is a Unix-like operating system that was designed to provide personal computer users a free or very low-cost operating system comparable to traditional and usually more expensive Unix systems. Linux has a reputation as a very efficient and fast-performing system. Linux's kernel (the central part of the operating system) was developed by Linus Torvalds at the University of Helsinki in Finland. To complete the operating system, Torvalds and other team members made use of system components developed by members of the Free Software Foundation for the GNU Project.
Q.6 What is Mozilla web browser? Ans: A web browser is a software application for viewing webpages. Microsoft Internet Explorer, Mozilla FireFox, Opera, and Apple Safari are the most common web browsers. Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. A Net Applications statistic put Firefox at 24.41% of the recorded usage share of web browsers as of January 2010, making it the second most popular browser in terms of current use worldwide after Microsoft's Internet Explorer, and the most used browser independent of any one operating system. Other sources put Firefox's usage share at between 21% and 32% and generally trending upward.
Q.7 What is Apache Server? Ans: 1. The Apache http server o is a powerful, flexible, HTTP/1.1 compliant web server o implements the latest protocols, including HTTP/1.1 (RFC2616) o is highly configurable and extensible with third-party modules
o can be customized by writing 'modules' using the Apache module API o provides full source code and comes with an unrestrictive license o runs on Windows NT/9x, Netware 5.x and above, OS/2, and most versions of Unix, as well as several other operating systems o is actively being developed o encourages user feedback through new ideas, bug reports and patches o implements many frequently requested features, including: 1.DBM databases for authentication 2.Customized responses to errors and problems 3.Multiple DirectoryIndex directives 4.Unlimited flexible URL rewriting and aliasing 5.Content negotiation 6.Virtual Hosts 7.Configurable Reliable Piped Logs
Q.8 What is Postgres?
Ans: This is regarded as one of the most successful open source database in the world. This is also used to create advanced applications. This relies on Object relational database management system. Familiarity with UNIX and Linux can be an added advantage while using Postgre These are the following features which are present in PostgreSQL they are 1) Object relational database 2) Extensibility and support for SQL 3) Database validation and flexible API 4) Procedural languages and MVCC 5) Client server and WAL.
Q.9 What is MySQL? Ans: MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, 1998. MySQL as an alternative to the proprietary database systems from Oracle, IBM, and Informix. MySQL is currently available under two different licensing agreements: free of charge, under the GNU General Public License (GPL) open source system or through subscription to MySQL Network for business applications. MySQL is used in a wide range of applications, including data warehousing, e- commerce, Web databases, logging applications and distributed applications.
Q.10 What is Pango? Ans: Pan is a Greek word meaning "all" and go is a Japanese word meaning "languages." Indeed, that is what Pango hopes to support -- all languages.
Pango is open source software that seeks to create a software framework so that international text characters can be electronically rendered. Though most of those who speak English may not realize it, many languages are not represented or are underrepresented on the Internet and in other software applications. Mostly, that is due to software applications not supporting characters in those languages.
Q.11 What is Open office Tomact? Ans: Tomcat is a Java Servlet container and web server from Jakartha project of Apache software foundation. A web server sends web pages as response to the requests sent by the browser client. In addition to the static web pages, dynamic web pages are also sent to the web browsers by the web server. Tomcat is sophisticated in this respect, as it provides both Servlet and JSP technologies. Tomcat provides a good choice as a web server for many web applications and also a free Servlet and JSP engine. Tomcat can be used standalone as well as behind other web servers such as Apache httpd.
Q.12 What is PHP? Ans : PHP stands for PHP: Hypertext Preprocessor, with that PHP standing for Personal HomePage [Tools]. This type of acronym is known as a retronym. Originally, in 1994, the language was designed as a small set of binaries used to collect some basic site traffic data. In 1997 the parser was rewritten by two Israelis and the name was changed to the current acronym it being determined that hypertext preprocessor was a decidedly more acceptable name in the business world. The PHP allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. PHP is a server-side scripting language for creating dynamic Web pages. You create pages with PHP and HTML. PHP is Open Source and cross-platform.
Q.13 What is Python? Ans : Python is an interpreted, interactive, object-oriented programming language". Python, although similar in some ways to Perl and Java, is its own creature. Python is great for both shell and web scripting and is making it's way into every facet of computing from Google to video games. Python is a programming language that is freely available and that makes solving a computer problem almost as easy as writing out one's thoughts about the solution. It can be written once and run on almost any computer without needing to change the program.
Q.14 What is proprietary software? Explain with examples. Ans: Many of the systems and applications programs used today are proprietary software . This means that someone owns the rights to the program, and the owner expects users to buy their own copies. Microsoft Office is a typical
example. If you want to acquire this software to write letters or produce graphics, you must purchase a registered copy in a store, through a mail order house, or over the internet. In buying the software, you pay not to own it, but to acquire a license that makes you an authorized user. Organizations such as businesses and schools, which may need software for use by several people, generally acquire site licenses that allow access by multiple users.
If you buy a copy of Microsoft Office for your own use, you cannot legally make copies of it for your friends, nor can you reproduce parts of the packages 's code to build your own suite program. You cannot eve rent or lease the software to others. You have bought only the right to operate the software yourself and for its intended use creating documents. Parts of the price that you pay for the program becomes profit for the software publisher Microsoft Cooperation for its effort in bringing the product to the marketplace.
Q.15 What is W3C? Ans: In 1994, five years after inventing the World Wide Web, Tim Berners-Lee founded the World Wide Web Consortium (W3C) at the Massachusetts Institute of Technology (MIT). The mission of W3C is "To lead the World Wide Web to its full potential by developing protocols and guidelines that ensure long-term growth for the Web." Though W3C has its detractors, most agree that the W3C today enjoys the respect and support of a wide range of key industries, organizations and individuals. In the early days however, support for W3C was very guarded or not forthcoming at all. The W3C is an industry consortium which seeks to promote standards for the evolution ofthe Web and interoperability between WWW products by producing specifications andreference software. Although W3C is funded by industrial members, it is vendor-neutral,and its products are freely available to all.
Q.16 What is FSF? Ans: The free software foundation is dedicated to eliminating restrictions on peoples right to use, copy, modify, and redistribute computer programs A nonprofit organisation, based in Massachusetts, that is devoted to the ideal of the free sharing of useful software for noncommercial purposees. To promote this goal, FSF supports a UNIX compatible operating system (called GNU) and system utilities, which are freely redistributable under FSF' GPL (General Public License).The major project of FSF is the GNU.
Q.17 What is Apache Tomcat? Ans: Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process.
Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. To learn more about getting involved, click here. Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Q.18 What is the basic difference between Unicode and ISCII code? Ans: Unicode uses a 16 bit encoding that provides code point for more than 65000 characters (65536). Unicode Standards assigns each character a unique numeric value and name. Unicode standard provides the capacity to encode all of the characters used for the written languages of the world.
ISCII uses 8 bit code which is an extension of the 7 bit ASCII code containing the basic alphabet required for the 10 Indian scripts which have originated from the Brahmi script. There are 15 officially recognized languages in India. Apart from Perso-Arabic scripts, all the other 10 scripts used for Indian languages have evolved from the ancient Brahmi script and have a common phonetic structure, making a common character set possible. The ISCII Code table is a super set of all the characters required in the Brahmi based Indian scripts. For convenience, the alphabet of the official script Devnagari has been used in the standard.
Q.19 What is Freeware? Ans. Freeware is software offered free of charge, downloadable off of the Internet. If the software requires the user to view ads while using the program, it is technically not freeware but adware. Freeware is also different from shareware in that shareware requires a payment if the software is to be used past a trial date. Though freeware does not require financial compensation, it does have a user license or EULA (End User License Agreement). Each license is specific to the freeware it is bundled with, but some restrictions are common to most programs. For example, most freeware forbids the user to alter the program, repackage it, or sell it. It might allow redistribution, however, as long as the program is unchanged and the license agreement intact.
Q.20 What is Linux? Ans: Linux is a Unix-like operating system that was designed to provide personal computer users a free or very low-cost operating system comparable to traditional and usually more expensive Unix systems. Linux has a reputation as a very efficient and fast-performing system. Linux's kernel (the central part of the operating system) was developed by Linus Torvalds at the University of Helsinki in Finland. To complete the operating system, Torvalds and other team members
made use of system components developed by members of the Free Software Foundation for the GNU Project.
Q.21 What do the terms 'internationalization' and 'localization' mean, and how are they related? Ans: Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a "locale"). Localization is sometimes written as "l10n", where 10 is the number of letters between 'l' and 'n'. Often thought of only as a synonym for translation of the user interface and documentation, localization is often a substantially more complex issue. It can entail customization related to: 1. Numeric, date and time formats 2. Use of currency 3. Keyboard usage 4. Collation and sorting 5. Symbols, icons and colors 6. Text and graphics containing references to objects, actions or ideas which, in a given culture, may be subject to misinterpretation or viewed as insensitive. 7. Varying legal requirements 8. and many more things. Localization may even necessitate a comprehensive rethinking of logic, visual design, or presentation if the way of doing business (eg., accounting) or the accepted paradigm for learning (eg., focus on individual vs. group) in a given locale differs substantially from the originating culture.
Internationalization Definitions of internationalization vary. This is a high-level working definition for use with W3C Internationalization Activity material. Some people use other terms, such as 'globalization' to refer to the same concept. Internationalization is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language. Internationalization is often written "i18n", where 18 is the number of letters between 'i' and 'n' in the English word.
Internationalization typically entails: 1. Designing and developing in a way that removes barriers to localization or international deployment. This includes such things as enabling the use of Unicode, or ensuring the proper handling of legacy character encodings where appropriate, taking care over the concatenation of strings, avoiding dependance in code of user-interface string values, etc.
2. Providing support for features that may not be used until localization occurs. For example, adding markup in your DTD to support bidirectional text, or for identifying language. Or adding to CSS support for vertical text or other non-Latin typographic features. 3. Enabling code to support local, regional, language, or culturally related preferences. Typically this involves incorporating predefined localization data and features derived from existing libraries or user preferences. Examples include date and time formats, local calendars, number formats and numeral systems, sorting and presentation of lists, handling of personal names and forms of address, etc. 4. Separating localizable elements from source code or content, such that localized alternatives can be loaded or selected based on the user's international preferences as needed.
Q.22 Describe in brief about websites that supports Open Sourc software.
Ans: 1. www.sourceforge.net : SourceForge.net is the world's largest open source software development web site. We provide free services that help people build cool stuff and share it with a global audience. As of February, 2009, more than 230,000 software projects have been registered to use our services by more than 2 million registered users, making SourceForge.net the largest collection of open source tools and applications on the net. SourceForge.net is owned and operated by Geeknet, Inc., a publicly traded US- based company.
2. www.openRDF.org : The openRDF.org site is a community site that is the center for all Sesame-related development. Here, developers and users can meet and discuss, ask questions and submit problem reports. The latest news about Sesame will be posted here. Sesame is an open source RDF framework with support for RDF Schema inferencing and querying. Originally, it was developed by Aduna (then known as Aidministrator) as a research prototype for the EU research project On-To-Knowledge. Now, it is further developed and maintained by Aduna in cooperation with NLnet Foundation, developers from Ontotext, and a number of volunteer developers who contribute ideas, bug reports and fixes. Sesame has been designed with flexibility in mind. It can be deployed on top of a variety of storage systems (relational databases, in-memory, filesystems, keyword indexers, etc.), and offers a large scala of tools to developers to leverage the power of RDF and RDF Schema, such as a flexible access API, which supports both local and remote (through HTTP or RMI) access, and several query languages, of which SeRQL is the most powerful one.
3. www.linux.org : Linux is a free Unix-type operating system originally created by Linus Torvalds with the assistance of developers around the world.
Developed under the GNU General Public License , the source code for Linux is freely available to everyone. Click on the link below to find out more about the operating system that is causing a revolution in the world of computers.
4. www.gnu.org : GNU was launched in 1984 to develop a complete Unix-like operating system which is free software software which respects your freedom. Unix-like operating systems are built from a collection of libraries, applications and developer tools plus a program to allocate resources and talk to the hardware, known as a kernel. Hurd, GNU's kernel is actively developed, but is still some way from being ready for daily use, so GNU is often used with a kernel called Linux. The combination of GNU and Linux is the GNU/Linux operating system, now used by millions and sometimes incorrectly called simply 'Linux'
Chapter 3 Data Base Mangement System
Q.1 Define the Basic MYSQL command with syntax and examples. Ans Basic mysql statements that should prove useful for basic CRUDS operations (create, replace, update, delete, select).
CREATE DATABASE: CREATE DATABASE database_name ; Will create a mysql database. CREATE TABLE CREATE TABLE IF NOT EXISTS table_name ( 'id VARCHAR(255) UNIQUE NOT NULL', 'artist TEXT', 'album TEXT', 'title TEXT', 'track TEXT', 'year TEXT', FULLTEXT (artist,album,title)'; ) TYPE=myisam; Will create a table on the database you are currently logged into.
INSERT STATEMENTS INSERT INTO table_name ( `col_A`, `col_B`, `col_C`) VALUES ( `col_A_data`, `col_B_data`, `col_C_data`) ; Inserts a row into the table using the data defined in the VALUES section.
REPLACE STATEMENTS REPLACE INTO table_name ( `col_A`, `col_B`) VALUES ( `col A data`, `col B data`) ; Replaces items in a row. This action is dependant on the "id" because all tables need to have at least one "unique" column. Meaning that one of the columns must be used to provide row data that is unique to each row. In this example, "id" is the unique row.
UPDATE STATEMENTS UPDATE table_name SET col_B='new_data' WHERE col_A='reference_data' ; Will update a row's columns with the new values specified in the SET section and the row to update is specified by the WHERE section
SELECT STATEMENTS SELECT * FROM table_name WHERE 1 ;
Returns all rows and all columns from table_name.. All rows is specified by the * (asterisk) symbol between SELECT and FROM. NOTE: All rows is specified by the * symbol between SELECT and FROM sections.
SELECT * FROM table_name WHERE column_name IN ('data_1','data_2') ;
Returns all rows* and all columns that have matching data specified in the IN section. The data defined in the IN section must match exactly.
SELECT col_A_name, col_B_name FROM table_name WHERE col_B_name='search_term' ; Returns only two columns from the matching row. The data defined int eh WHERE section must match exactly.
SELECT col_A_name, col_B_name FROM table_name WHERE col_B_name IN ('search_term_1','search_term_2') ; Returns only two columns that match the data defined in the IN section
SELECT * FROM table_name WHERE col_A_name RLIKE ('search_terma') OR col_B_name RLIKE ('search_termb') ; This example will search through your table for matching words.
SELECT * FROM table_name WHERE col_A_name RLIKE ('search_terma') AND col_B_name RLIKE ('search_termb') ; This example will search through your table for matching words. Will return all rows that contain either search_terma OR search_term_B -- the search terms can be a single word or a phrase.
SELECT * FROM table_name WHERE 1 ORDER BY RAND() LIMIT number_of_rows_to_return ; Will select random rows and limit the number of rows returned to the number specified in the LIMIT section.
SELECT DISTINCT col_A FROM table_name WHERE 1; Will only return rows that have unique data in the column specified
SELECT DISTINCT col_A,col_B FROM table_name WHERE 1 ORDER BY RAND() LIMIT number_of_rows_to_return ; You can add the DISTINCT statement to any statement. So that only unique items are returned. Or another way to think about it is that no duplicate rows are returned. For example, if you used the RLIKE statement to look for a couple key words, mysql may return the dame row two times, you can use the DISTINCT statement to filter only unique rows.
SELECT MAX(col_A) FROM table_name ; Will return the highest value for that column. Usually you want to sue this on a column that references a number. For example, let's say you wanted to find the highest ID on your table so that you could determine the next ID to use fro a new item that you are inserting into your tables. You could use the MAX statement to find the largest ID number, then when you INSERT your new item, you can simply bump up the number by one. SELECT MAX(track) FROM music ;
DELETE STATEMENTS DELETE FROM table_name WHERE column_name='search_data'; Will remove rows that match the search data defined in the WHERE section. DELETE FROM table_name WHERE column_name IN ('search_data_A', 'search_data_B'); Will remove all rows that match the search data defined in the IN section.\
Q. 2 Define ACID properties of DBMS. Ans ACID properties are an important concept for databases. The acronym stands for Atomicity, Consistency, Isolation, and Durability. The ACID properties of a DBMS allow safe sharing of data. Without these ACID properties, everyday occurrences such using computer systems to buy products would be difficult and the potential for inaccuracy would be huge.
Q.3 Defines transaction in DBMS. Ans A database transaction is a larger unit that frames multiple SQL statements. A transaction ensures that the action of the framed statements is atomic with respect to recovery. SQL-Transaction Statements control transactions in database access. This subset of SQL is also called the Data Control Language for SQL (SQL DCL).
Q.4 Define Transactions control Commands in SQL. Ans. There are three commands used to control transactions: 1) BEGIN or START TRANSACTION or BEGIN WORK ->Begin command is used to mark the beginning of a transaction. Or Start a new transaction. Syntax BEGIN ;
2) COMMIT Command ->The commit command saves all transactions to the database since the last COMMIT or ROLLBACK command. Syntax commit [work];
3) ROLLBACK Command ->The rollback command is the transactional control command used to undo transactions that have not already been saved to the database. The rollback command can only be used to undo transactions since the last COMMIT or ROLLBACK command was issued. Syntax SQL>rollback [work];
4) SAVEPOINT Command ->A savepoint is a point in a transaction that you can roll the transaction back to without rolling back the entire transaction. Syntax SQL>SAVEPOINT
5) SET autocommit Autocommit is a mode of operation of a database connection. Each individual database interaction (i.e., each SQL statement) submitted through the database connection in autocommit mode will be executed in its own transaction that is implicitly committed. Synatx:
SET autocommit =0 {for Disable autocommit)
SET autocommit=0; (for enable autocommit) By default mysql has autocommite on.
Q. 5 Define different type of Functions in SQL. Ans Functions are a self contained script/program built for a specific purpose. Generally, the value returned by a function will depend on the context in which it is being used. Often, a SQL function will be used within a query and this is what provides it with it's context. SQL provides 3 different types of functions:
Rowset Functions These return an object that can be used in place of a table reference in a SQL statement
Aggregate Functions Perform a calculation on a set of values and return a single value. Aggregate functions can be used in the following: The select list of a SELECT statement A COMPUTE or COMPUTE BY clause
A HAVING clause
Scalar Functions These return a single value from a single value. Scalar functions are categorized as follows: Configuration Functions Cursor Functions Date and Time Functions Mathematical Functions Metadata Functions Security Functions String Functions System Functions System Statistical Functions Text and Image Functions
Q.6 Define Aggregated (Group) functions in SQL. Ans : The SQL Aggregate Functions are functions that provide mathematical operations. The functions include: Count() - counts a number of rows Sum() - compute sum Avg() - compute average Min() - compute minimum Max() - compute maximum
SUM Function SUM function returns the sum of all values in an expression. To get the total money for each selling product we just use the SUM function and group by product. Here is the query: SELECT productcode,sum(priceeach * quantityordered) total FROM orderdetails GROUP by productcode
AVG Function AVG is used to calculate average value of an expression. It ignores NULL values. AVG(expression) We can use AVG function to calculate the average price of all products buy executing the following query. SELECT AVG(buyprice) average_buy_price FROM Products
MAX and MIN Function MAX function returns the maximum and MIN function returns the minimum value of the set of values in expression. MAX(expression)
MIN(expression) As an example, we can use MIN and MAX function to retrieve the highest and lowest price product as follows: SELECT MAX(buyprice) highest_price, MIN(buyprice) lowest_price FROM Products
COUNT Function COUNT function returns the count of the items in expression. We can use COUNT function to count how many products we have as follows: SELECT COUNT(*) AS Total FROM products
Q.17 Define GROUP by Clouse in MYSQL, With Having Statement. Ans The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns. Group by clause is used to divide the result in groups. Select Job, Count(*) from Emp GROUP BY Job; HAVING HAVING clause places conditions on GROPUS in Contain to WHERE clause that place conditions on Individual rows. While WHERE conditions cannot include aggregate functions, Having Condition cannot do so. SELECT AVG(gros), SUM(gross) FROM emp GROPU BY garde HAVING grade=E2;
Q.18 Define JOINE in SQL with its types. Ans An SQL JOIN clause combines records from two or more tables in a database.It creates a set that can be saved as a table or used as is. A JOIN is a means for combining fields from two tables by using values common to each. Four types of joins: INNER, OUTER, LEFT, and RIGHT. In special cases, a table (base table, view, or joined table) can JOIN to itself in a self-join.
Inner Join An inner join is the most common join operation used in applications and can be regarded as the default join-type. Inner join creates a new result table by combining column values of two tables (A and B) based upon the join-predicate. The query compares each row of A with each row of B to find all pairs of rows which satisfy the join-predicate. When the join-predicate is satisfied, column values for each matched pair of rows of A and B are combined into a result row.
SELECT * FROM employee INNER JOIN department ON Employee.departmentid = department.departmentid
Equi-join An equi-join, also known as an equijoin, is a specific type of comparator-based join, or theta join, that uses only equality comparisons in the join-predicate. Using other comparison operators (such as <) disqualifies a join as an equi-join. SELECT * FROM employee INNER JOIN department ON Employee.departmentid = department.departmentid
Natural join A natural join offers a further specialization of equi-joins. The join predicate arises implicitly by comparing all columns in both tables that have the same column-name in the joined tables. The resulting joined table contains only one column for each pair of equally-named columns. SELECT * FROM employee NATURAL JOIN department.
Cross join A cross join, Cartesian join or product provides the foundation upon which all types of inner joins operate. A cross join returns the Cartesian product of the sets of records from the two joined tables. Thus, it equates to an inner join where the join-condition always evaluates to True or where the join-condition is absent from the statement. In other words, a cross join combines every row in B with every row in A. The number of rows in the result set will be the number of rows in A times the number of rows in B. Thus, if A and B are two sets, then the cross join is written as A B. The SQL code for a cross join lists the tables for joining (FROM), but does not include any filtering join-predicate. SELECT * FROM employee CROSS JOIN department
Outer joins An outer join does not require each record in the two joined tables to have a matching record. The joined table retains each recordeven if no other matching record exists. Outer joins subdivide further into left outer joins, right outer joins, and full outer joins, depending on which table(s) one retains the rows from (left, right, or both). (In this case left and right refer to the two sides of the JOIN keyword.) No implicit join-notation for outer joins exists in standard SQL.
SELECT * FROM employee LEFT OUTER JOIN department ON employee.departmentid = department.departmentid
SELECT * FROM employee RIGHT OUTER JOIN department ON employee.departmentid = department.departmentid
Self-join A self-join is joining a table to it self. This is best illustrated by the following example.
Q. 7 What is Cartesian Product ? How it is related to join. Ans: The Cartesian product, also referred to as a cross-join, returns all the rows in all the tables listed in the query. Each row in the first table is paired with all the rows in the second table. This happens when there is no relationship defined between the two tables.
Q.8 What is Constraints in SQL define it. OR Difference between Primary Key and Foreign Key. OR What is Integrity Constraints, Describe two types. Ans An integrity constraint is a condition that is enforced automatically by the DBMS and whose violation prevents the data from being stored in the database. The DBMS enforces integrity constraints in that it only permits legal instances to be stored in the database. The key constraint and the referential integrity constraints are identified as the two minimum constraints that must be enforced by the DBMS.
1 Key constraint or unique constraint: Every record must have one unique identifier called the primary key that has a unique value within the table or collection. Primary keys can be concatenated, which means that the uniqueness can be made up of one or more fields.
2. Referential integrity constraint or foreign key constraint: This constraint asserts that a reference in one data item indeed leads to another data item. A foreign key is a field that is a primary key in another table. Referential integrity consists of:
Not inserting a record if the value of the foreign key being inserted does not match an existing record in another table with the primary key having the same value, Not deleting a record whose primary key is defined as a foreign key in child records and Not modifying the value of primary keys.
Syntax of Integrity Constraints 1) SQL Primary key: This constraint defines a column or combination of columns which uniquely identifies each row in the table.
Syntax to define a Primary key at table level:
[CONSTRAINT constraint_name] PRIMARY KEY (column_name1,column_name2,..) Column_name1, column_name2 are the names of the columns which define the primary Key.
The syntax within the bracket i.e. [CONSTRAINT constraint_name] is optional. For Example: To create an employee table with Primary Key constraint, the query would be like. Primary Key at table level: CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), salary number(10), location char(10) ); Or CREATE TABLE employee ( id number(5) CONSTRAINT emp_id_pk PRIMARY KEY, name char(20), dept char(10), age number(2), salary number(10), location char(10) ); Primary Key at table level: CREATE TABLE employee ( id number(5), name char(20),dept char(10),age number(2), salary number(10),location char(10),CONSTRAINT emp_id_pk PRIMARY KEY (id));
2) SQL Foreign key or Referential Integrity : This constraint identifies any column referencing the PRIMARY KEY in another table. It establishes a relationship between two columns in the same table or between different tables. For a column to be defined as a Foreign Key, it should be a defined as a Primary Key in the table which it is referring. One or more columns can be defined as Foreign key. Syntax to define a Foreign key at table level: [CONSTRAINT constraint_name] FOREIGN KEY(column_name) REFERENCES referenced_table_name(column_name); For Example: Foreign Key at table level: CREATE TABLE order_items ( order_id number(5) , product_id number(5), product_name char(20), supplier_name char(20), unit_price number(10) CONSTRAINT od_id_pk PRIMARY KEY(order_id), CONSTRAINT pd_id_fk FOREIGN KEY(product_id) REFERENCES product(product_id) );
If the employee table has a 'mgr_id' i.e, manager id as a foreign key which references primary key 'id' within the same table, the query would be like, CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), mgr_id number(5) REFERENCES employee(id), salary number(10), location char(10) );
3) SQL Not Null Constraint : This constraint ensures all rows in the table contain a definite value for the column which is specified as not null. Which means a null value is not allowed. Syntax to define a Not Null constraint: [CONSTRAINT constraint name] NOT NULL For Example: To create a employee table with Null value, the query would be like CREATE TABLE employee ( id number(5), name char(20) CONSTRAINT nm_nn NOT NULL, dept char(10), age number(2), salary number(10), location char(10) );
4) SQL Unique Key: This constraint ensures that a column or a group of columns in each row have a distinct value. A column(s) can have a null value but the values cannot be duplicated. Syntax to define a Unique key at column level: [CONSTRAINT constraint_name] UNIQUE Syntax to define a Unique key at table level: [CONSTRAINT constraint_name] UNIQUE(column_name) For Example: To create an employee table with Unique key, the query would be like, Unique Key at column level: CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), salary number(10), location char(10) UNIQUE ); Unique Key at table level: CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), salary number(10), location char(10), CONSTRAINT loc_un UNIQUE(location) );
5) SQL Check Constraint : This constraint defines a business rule on a column. All the rows must satisfy this rule. The constraint can be applied for a single column or a group of columns. Syntax to define a Check constraint: [CONSTRAINT constraint_name] CHECK (condition) For Example: In the employee table to select the gender of a person, the query would be like Check Constraint at column level: CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), gender char(1) CHECK (gender in ('M','F')), salary number(10), location char(10) );
Check Constraint at table level: CREATE TABLE employee ( id number(5) PRIMARY KEY, name char(20), dept char(10), age number(2), gender char(1), salary number(10), location char(10), CONSTRAINT gender_ck CHECK (gender in ('M','F')) );
Q.17 What is the difference between mysql and mysql. Ans mysql is used to refer to the entire mysql distribution package or the mysql server, while mysql refers to a client program.
Q. 18 Client server Architecture of MYSQL. Ans: The MYSQL architecture is based on five components, Show in Following Daigram :
Application: An application is a program that calls the ODBC API to access the data from the mysql server. The Application communicates with the Driver Manager using the standard ODBC calls. The Application does not care where the data is stored, how it is stored, or even how the system is configured to access the data. It needs to know only the Data Source Name (DSN). A number of tasks are common to all applications, no matter how they use ODBC. These tasks are: Selecting the mysql server and connecting to it Submitting SQL statements for execution Retrieving results (if any) Processing errors Committing or rolling back the transaction enclosing the SQL statement Disconnecting from the mysql server Because most data access work is done with SQL, the primary tasks for applications that use ODBC are submitting SQL statements and retrieving any results generated by those statements. Driver manager: The Driver Manager is a library that manages communication between application and driver or drivers. It performs the following tasks: Resolves Data Source Names (DSN)
Driver loading and unloading Processes ODBC function calls or passes them to the driver Myodbc Driver: The myodbc driver is a library that implements the functions in the ODBC API. It processes ODBC function calls, submits SQL requests to mysql server, and returns results back to the application. If necessary, the driver modifies an application's request so that the request conforms to syntax supported by the mysql. ODBC.INI: ODBC.INI is the ODBC configuration file that stores the driver and database information required to connect to the server. It is used by the Driver Manager to determine which driver to be loaded using the Data Source Name. The driver uses this to read connection parameters based on the DSN specified. For more information, Section 25.1.9, myodbc Configuration . Mysql Server: The mysql server is the source of data. Mysql is: A database management system (DBMS) A relational database management system (RDBMS) Open Source Software
Chapter 4 Java Programming Review of Class XI
Q.1 Define Netbeans JAVA IDE environment. Ans: Using an Integrated Development Environment (IDE) for developing applications saves you time by managing windows, settings, and data. In addition, an IDE can store repetitive tasks through macros and abbreviations. Drag-and-drop features make creating graphical user interface (GUI) components or accessing databases easy, and highlighted code and debugging features alert you to errors in your code. The netbeans IDE is open source and is written in the Java programming language. It provides the services common to creating desktop applications -- such as window and menu management, settings storage -- and is also the first IDE to fully support JDK 6.0 features. The netbeans platform and IDE are free for commercial and noncommercial use, and they are supported by Sun Microsystems.
Q 2 Define GUI , with JAVA GUI toolkit OR Define Swing in JAVA. Ans: GUI stand for Graphical User Interface, in GUI application windows , buttons, dialogs, menus and everything visual in a modern application. It also involves properties of its components, actions and events. Swing is the "built-in" GUI component technology of the Java platform. Swing is the successor to the AWT technology that was provided with the early releases of the Java platform.? In one sense, Swing replaces AWT. To create a Java program with a graphical user interface (GUI), you'll want to learn about Swing. The Swing toolkit includes a rich set of components for building guis and adding interactivity to Java applications. Swing includes all the components you would expect from a modern toolkit: table controls, list controls, tree controls, buttons, and labels. Swing is part of the Java Foundation Classes (JFC). The JFC also include other features important to a GUI program, such as the ability to add rich graphics functionality and the ability to create a program that can work in different languages and by users with different input devices.
Q.3 Define Data types in JAVA. ANS: There are 8 primitive data types. he 8 primitive data types are numeric types. The names of the eight primitive data types are:
int, long, float, double, char, Boolean. There are both integer and floating point primitive types. Integer types have no fractional part; floating point types have a fractional part. On paper, integers have no decimal point, and floating point types do. But in main memory, there are no decimal points: even floating point values are represented with bit patterns. There is a fundamental difference between the method used to represent integers and the method used to represent floating point numbers.
Exam ples int yr = 2006; doubl e rats = 8912 ;
Integer Primitive Data Types Type Size Range byte 8 bits -128 to +127 short 16 bits -32,768 to +32,767 int 32 bits (about)-2 billion to +2 billion long 64 bits (about)-10E18 to +10E18
Floating Point Primitive Data Types Type Size Range float 32 bits -3.4E+38 to +3.4E+38 double 64 bits -1.7E+308 to 1.7E+308
For each primitive type, there is a corresponding wrapper class. A wrapper class can be used to convert a primitive data value into an object, and some type of objects into primitive data. The table shows primitive types and their wrapper classes:
Q. 4 Define Object Oriented Language with Class and Methods. Or Difference Between Procedural Programming language and OOP language. Ans: Procedural programming you try to make the real world problem you're attempting to solve fit a few, predetermined data types: integers, floats, Strings, and arrays perhaps. In object oriented programming you create a model for a real world system. Classes are programmer-defined types that model the parts of the system. A class is a programmer defined type that serves as a blueprint for instances of the class. You can still have ints, floats, Strings, and arrays; but you can also have cars, motorcycles, people, buildings, clouds, dogs, angles, students, courses, bank accounts, and any other type that's important to your problem. Classes specify the data and behavior possessed both by themselves and by the objects built from them. A class has two parts: the fields and the methods. Fields describe what the class is. Methods describe what the class does.
Q. 5 Define Java Basics. 1. Java statements and expressions 2. Variables and data types 3. Comments 4. Literals 5. Arithmetic 6. Comparisons 7. Logical operators Ans: 1. Java statements and expressions 1. A statement is the simplest thing you can do in Java; a statement forms a single Java operation. Examples : int i = 1; Statements sometimes return valuesfor example, when you add two numbers together or test to see whether one value is equal to another. The most important thing to remember about Java statements is that each one ends with a semicolon. Forget the semicolon and your Java program wont compile. Java also has compound statements, or blocks, which can be placed wherever a single statement can. Block statements are surrounded by braces ({}).
2. Variables and data types
Variables are locations in memory in which values can be stored. They have a name, a type, and a value. Before you can use a variable, you have to declare it. After it is declared, you can then assign values to it. Java actually has three kinds of variables: instance variables, class variables, and local variables. 1. Instance variables, are used to define attributes or the state for a particular object. 2. Class variables are similar to instance variables, except their values apply to all that classs instances (and to the class itself) rather than having different values for each object. 3. Local variables are declared and used inside method definitions, for example, for index counters in loops, as temporary variables, or to hold values that you need only inside the method definition itself. Unlike other languages, Java does not have global variablesthat is, variables that are global to all parts of a program.
Declaring Variables
To use any variable in a Java program, you must first declare it. Variable declarations consist of a type and a variable name:
int myAge; String myName; boolean isTired; Variable definitions can go anywhere in a method definition (that is, anywhere a regular Java statement can go), although they are most commonly declared at the beginning of the definition before they are used:
public static void main (String args ]) { int count; String title; boolean isAsleep; ... } You can string together variable names with the same type: int x, y, z; String firstName, LastName; You can also give each variable an initial value when you declare it: int myAge, mySize, numShoes = 28;
String myName = Laura; boolean isTired = true; int a = 4, b = 5, c = 6; If there are multiple variables on the same line with only one initializer (as in the first of the previous examples), the initial value applies to only the last variable in a declaration. You can also group individual variables and initializers on the same line using commas, as with the last example, above.
Variable Names Variable names in Java can start with a letter, an underscore (_), or a dollar sign ($). They cannot start with a number. After the first character, your variable names can include any letter or number. Symbols, such as %, *, @, and so on, are often reserved for operators in Java, so be careful when using symbols in variable names. In addition, the Java language uses the Unicode character set. Unicode is a character set definition that not only offers characters in the standard ASCII character set, but also several million other characters for representing most international alphabets.
Variable Types In addition to the variable name, each variable declaration must have a type, which defines what values that variable can hold. The variable type can be one of three things:
1. One of the eight basic primitive data types 2. The name of a class 3. An array
The eight primitive data types handle common types for integers, floating-point numbers, characters, and boolean values (true or false). Theyre called primitive because theyre built into the system and are not actual objects, which makes them more efficient to use. There are four Java integer types, each with different ranges.
Type Size Range byte 8 bits 128 to 127 short 16 bits -32,768 to 32,767
int 32 bits 2,147,483,648 to 2,147,483,647 long 64 bits 9223372036854775808 to 9223372036854775807
3. Comments: Java has three kinds of comments. /* and */ surround multiline comments, as in C or C++. All text between the two delimiters is ignored: /* I dont know how I wrote this next part; I was working really late one night and it just sort of appeared. I suspect the code elves did it for me. It might be wise not to try and change it. */ Comments cannot be nested; that is, you cannot have a comment inside a comment. Double-slashes (//) can be used for a single line of comment. All the text up to the end of the line is ignored: int vices = 7; // are there really only 7 vices? The final type of comment begins with /** and ends with */. These are special comments that are used for the javadoc system.
4. Literals Literals are used to indicate simple values in your Java programs. Literal is a programming language term, which essentially means that what you type is what you get. For example, if you type 4 in a Java program, you automatically get an integer with the value 4. If you type a, you get a character with the value a.
Number Literals There are several integer literals. 4, for example, is a decimal integer literal of type int (although you can assign it to a variable of type byte or short because its small enough to fit into those types). A decimal integer literal larger than an int is automatically of type long. Integers can also be expressed as octal or hexadecimal: a leading 0 indicates that a number is octalfor example, 0777 or 0004. A leading 0x (or 0X) means that it is in hex (0xFF, 0XAF45). Hexadecimal numbers can contain regular digits (09) or upper- or lowercase hex digits (af or AF). Floating-point literals usually have two parts: the integer part and the decimal partfor example, 5.677777. Floating-point literals result in a floating-point number of type double, regardless of the precision of that number. You can force the
number to the type float by appending the letter f (or F) to that numberfor example, 2.56F.
Boolean Literals Boolean literals consist of the keywords true and false. These keywords can be used anywhere you need a test or as the only possible values for boolean variables.
Character Literals Character literals are expressed by a single character surrounded by single quotes: a, #, 3, and so on. Characters are stored as 16-bit Unicode characters.
Character escape codes. Escape Meaning \n Newline \t Tab \b Backspace \r Carriage return \f Formfeed \\ Backslash \ Single quote \ Double quote \ddd Octal \xdd Hexadecimal \udddd Unicode character
String Literals A combination of characters is a string. Strings in Java are instances of the class String. Strings are not simple arrays of characters as they are in C or C++, although they do have many array like Characteristics (for example, you can test their length and add and delete individual characters as if they were arrays). Because string objects are real objects in Java, they have Methods that enable you to combine, test, and modify strings very easily.
5. Expressions and Operators Expressions are the simplest form of statement in Java that actually accomplishes something. Expressions are statements that return a value.
Operators are special symbols that are commonly used in expressions.
Comparisons Java has several expressions for testing equality and magnitude. All of these expressions return a boolean value (that is, true or false).
Operator Meaning Example == Equal x == 3 != Not equal x != 3 < Less than x < 3 > Greater than x > 3 Less than or equal to x 3 Greater than or equal to x 3
6. Logical Operators Expressions that result in boolean values (for example, the comparison operators) can be combined by using logical operators that represent the logical combinations AND, OR, XOR, and logical NOT. For AND combinations, use either the & or &&. For OR expressions, use either | or ||. In addition, there is the XOR operator ^, which returns true only if its operands are different (one true and one false, or vice versa) and false otherwise (even if both are true). For NOT, use the ! operator with a single expression argument.
Bitwise Operators Finally, heres a short summary of the bitwise operators in Java. These are all inherited from C and C++ and are used to perform operations on individual bits in integers. Bitwise operators. Operator Meaning & Bitwise AND
| Bitwise OR ^ Bitwise XOR << Left shift >> Right shift >>> Zero fill right shift ~ Bitwise complement <<= Left shift assignment (x = x << y) >>= Right shift assignment (x = x >> y) >>>= Zero fill right shift assignment (x = x >>> y) x&=y AND assignment (x = x & y) x|=y OR assignment (x + x | y) x^=y NOT assignment (x = x ^ y)
Q. 6 Define Array in details with examples. Ans: Arrays, one of the most useful objects in Java, which enable you to collect objects into an easy-to-manage list. Arrays in Java are different than they are in other languages. Arrays in Java are actual objects that can be passed around and treated just like other objects. Arrays are a way to store a list of items. Each element of the array holds an individual item, and you can place items into and remove items from those slots as you need to.
To create an array in Java, you use three steps: 1. Declare a variable to hold the array. 2. Create a new array object and assign it to the array variable. 3. Store things in that array.
Declare a variable to hold the array Array variables indicate the type of object the array will hold (just as they do for any variable) and the name of the array, followed by empty brackets ([]). The following are all typical array variable declarations:
String difficultWords[]; Point hits[]; int temps[];
Creating Array Objects There are two ways to do this: Using new Directly initializing the contents of that array
The first way is to use the new operator to create a new instance of an array: String[] names = new String[10]; Instead of using new to create the new array object,
enclose the elements of the array inside braces, separated by commas:
Accessing Array Elements Once you have an array with initial values, you can test and change the values in each slot of that array. To get at a value stored within an array, use the array subscript expression: myArray[subscript];
Multidimensional Arrays Java does not support multidimensional arrays. However, you can declare and create an array of arrays (and those arrays can contain arrays, and so on, for however many dimensions you need), and access them as you would C-style multidimensional arrays:
int coords[][] = new int[12][12]; coords[0][0] = 1; coords[0][1] = 2;
Q. 7 Define Basic Conditional Statements in JAVA. Ans: 1. if Conditionals The if conditional, which enables you to execute different bits of code based on a simple test in Java, is nearly identical to if statements in C. if conditionals contain the keyword if, followed by a boolean test, followed by a statement (often a block statement) to execute if the test is true:
if (x < y) System.out.println(x is smaller than y);
An optional else keyword provides the statement to execute if the test is false:
if (engineState) System.out.println(Engine is on.); else System.out.println(Engine is off);
2. The Conditional Operator An alternative to using the if and else keywords in a conditional statement is to use the conditional operator, sometimes called the ternary operator. A conditional operator is a ternary operator because it has three terms. The conditional operator is an expression, meaning that it returns a value (unlike the more general if, which can result in any statement or block being executed).
The conditional operator is most useful for very short or simple conditionals, and looks like this: test ? trueresult : falseresult
int smaller = x < y ? x : y;
3. Switch Conditionals A common practice in programming in any language is to test a variable against some value, and if it doesnt match that value, to test it again against a different value, and if it doesnt match that one to make yet another test, and so on.
switch (test) { case valueOne: resultOne; break; case valueTwo: resultTwo; break; case valueThree: resultThree; break; ... default: defaultresult; }
While and do Loops
while Loops The while loop is used to repeat a statement or block of statements as long as a particular condition is true. while loops look like this: while (condition) { bodyOfLoop; } The condition is a boolean expression. If it returns true, the while loop executes the statements in bodyOfLoop and then tests the condition again, repeating until the condition is false.
you can use a compound test with the && operator: while ((ch != ) && (ch != \t) && (ch != \n) && (ch != \r)) { addChar(ch, theName); ch = instream.read();
} do...while Loops The do loop is just like a while loop, except that do executes a given statement or block until a condition is false. The main difference is that while loops test the condition before looping, making it possible that the body of the loop will never execute if the condition is false the first time its tested. do loops run the body of the loop at least once before testing the condition. do loops look like this: do { bodyOfLoop; } while (condition);
Chapter 5
JAVA Programming-Advance
Q1 What is the difference between procedural and object-oriented programs? Ans: The difference between procedural and object-oriented programs is a) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the securityof the code
Q2. What are Encapsulation, Inheritance and Polymorphism? Ans: 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 more than one calss.In other world we can say polymorphism is a reusability of object in more than one class.
Q3. What is the difference between Assignment and Initialization? Ans: Assignment can be many times as desired whereas initialization can be only once.
Q4. What is OOPs? Ans: Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling access to code.
Q5. What are Class, Constructor and Primitive data types? Ans: Class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of object according to the data the object can hold and the operations the object can perform. Constructor is a special kind of method that determines how an object is initialized when created. The name of constructor is same as class name. Primitive data types are 8 types and they are: byte, short, int, long, float, double, Boolean, char.
Q6. What is an Object and how do you allocate memory to it? Ans: 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.
The object is created by using new keyword. When an object is created using new operator, memory is allocated to it.
Q7. What is the difference between constructor and method? Ans: Constructor will be automatically invoked when an object is created whereas method has to be called explicitly by using dot(.) operator .
Q8: What are methods and how are they defined? Ans: Methods are functions that operate on instances of classes in which they are defined. By use of the method objects can communicate with each other 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 methods signature is a combination of the first three parts mentioned above.
Q9 What is the use of bin and lib in JDK? Ans Bin contains all tools such as javac, appletviewer, awt tool, etc., whereas lib contains API and all packages.
Q10 What is casting? Ans Casting is process of convert the value of one type to another.
Q11 How many ways can an argument be passed to a subroutine and explain them? Ans An argument can be passed in two ways. They are passing by value and passing by reference. Passing by value: This method copies the value of an argument into the formal parameter of the subroutine. Passing by reference: In this method, a reference to an argument (not the value of the argument) is passed to the parameter.
Q12 What is the difference between an argument and a parameter? Ans At time of defining method, variables passed in the method are called parameters At time of using those methods, values passed to those variables are called arguments.
Q13 What are different types of access modifiers? Ans: There are following four types of access modifiers public: Any thing declared as public can be accessed from anywhere. private: Any thing declared as private cant 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 packages. default modifier : Can be accessed only to classes in the same package.
Q14 When we can declare a method as abstract method ? Ans When we have to want child class to implement the behavior of the method.
Q15 Can We call a abstract method from a non abstract method ? Ans Yes, We can call a abstract method from a Non abstract method in a Java abstract class
16 What is the difference between an Abstract class and Interface ? And can you explain when you are using an Abstract classes ? Ans: Abstract classes let you define some behaviors; they force your subclasses to provide others. These abstract classes will provide the basic functionality of your application, child class which inherited this class will provide the functionality of the abstract methods in abstract class. When base class calls this method, Java calls the method defined by the child class. An Interface can only declare constants and instance methods, but cannot implement default behavior. Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.Interfaces are slow as it requires extra indirection to find corresponding method in the actual class. Abstract classes are fast.
Q17 What is user-defined exception in java ? Ans User-defined expectations are the exceptions defined by the application developer which are errors related to specific application. Application Developer can define the user defined exception by inherited the Exception class as shown below. Using this class we can throw new exceptions for this we have use throw keyword . Example of user define exception Java Example :
1.Create an class which extends Exception:- public class greaterVlaueException extends Exception { } 2.Throw an exception using a throw statement: public class Fund { ... public Object getFunds() throws greaterVlaueException { if (id>2000) throw new greaterVlaueException(); ... }
} User-defined exceptions should usually be checked.
Q18 What is the difference between checked and Unchecked Exceptions in Java ? Ans 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 don't, compilation of program will fail. All exceptions in RuntimeExcetption and Error class are unchecked exception.
Q19 Explain garbage collection ? Ans Garbage collection is an important part of Java's security strategy. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects from the memory. The name "garbage collection" implies that objects that are no longer needed by the program are "garbage" and this object will destroy by garbage collector. A more accurate and up-to-date metaphor might be "memory recycling." When an object is no longer referenced by the program, the heap space it occupies must be recycled so that the space is available for subsequent new objects. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.
Q20 How you can force the garbage collection ? Ans: Garbage collection automatic process and can't be forced. We can call garbage collector in Java by calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.
Q21 What are the static fields & static Methods ? Ans: If a field or method defined as a static, there is only one copy for entire class, rather than one copy for each instance of class. static method cannot access non- static field or call non-static method
Q22 What are the Final fields & Final Methods ? Ans Fields and methods can also be declared final. Final method: A final method cannot be overridden in a subclass.
Final field: A final field is like a constant: once it has been given a value, it cannot be assigned to again.
Q23 Describe the wrapper classes in Java ?
Ans Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type. Following are the lists of the primitive types and the corresponding wrapper classes: Primitive Wrapper boolean java.lang.Boolean byte java.lang.Byte char java.lang.Character double java.lang.Double float java.lang.Float int java.lang.Integer long java.lang.Long short java.lang.Short void java.lang.Void
Q24 What are different types of inner classes ? Ans Inner classes nest within other classes. A normal class is a direct member of a package. Inner classes, which became available with Java 1.1, are four types: 1.Static member classes 2.Member classes 3.Local classes 4.Anonymous classes 1.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. 2.Member Classes: A member class is also defined as a member of a class. Unlike the static variety, the member class is instance specific and has access to any and all methods and members, even the parent's this reference. 3.Local Classes: Local Classes declared within a block of code and these classes are visible only within the block. 4.Anonymous Classes: These type of classes does not have any name and its like a local class
Q25 For concatenation of strings, which method is good, StringBuffer or String Ans StringBuffer is faster than String for concatenation.
Q26 What is Runnable interface ? Are there any other ways to make a java program as multithred java program? Ans The thread can be create by using two methods: 1.Define a new class that extends the Thread class 2.Define a new class that implements the Runnable interface, and pass an object of that class to a Thread's constructor. The advantage of implements the Runnable interface is that the new class can be a subclass of any class, not just of the Thread class.
Q26 How can we tell what state a thread is in ? Ans 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. Starting with the release of Tiger (Java 5) you can now get what state a thread is in by using the getState() method which returns an Enum of Thread.States.
Q27 What methods java providing for Thread communications ? Ans Java provides three methods that threads can use to communicate with each other: wait, notify, and notifyAll.
Q28 What is the difference between notify and notify All methods ? Ans A call to notify causes at most one thread waiting on the same object to be notified (i.e., the object that calls notify must be the same as the object that called wait). A call to notifyAll causes all threads waiting on the same object to be notified. If more than one thread is waiting on that object, there is no way to control which of them is notified by a call to notify (so it is often better to use notifyAll than notify).
Q29 What is synchronized keyword? In what situations you will Use it? Ans 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. Threads may execute in a manner where their paths of execution are completely independent of each other. Neither thread depends upon the other for assistance. For example, one thread might execute a print job, while a second thread repaints a window. And then there are threads that require synchronization, the act of serializing access to critical sections of code, at various moments during their executions. For example, say that two threads need to send data packets over a single network connection. Each thread must be able to send its entire data packet before the other thread starts sending its data packet; otherwise, the data is scrambled. This scenario requires each thread to synchronize its access to the code that does the actual data-packet sending. If you feel a method is very critical for business that needs to be executed by only one thread at a time (to prevent data loss or corruption), then we need to use synchronized keyword.
Q30:What is serialization ?
Ans: 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.
Q31 What does the Serializable interface do ? Ans 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.
Q32 How do I serialize an object to a file ? Ans To serialize an object into a stream perform the following actions: 1. Open one of the output streams, for example FileOutputStream. 2. Chain it with the ObjectOutputStream - Call the method writeObject() providing the instance of a Serializable object as an argument. 3.Close the streams Java Code --------- try{ fOut= new FileOutputStream("c:\\raj.ser"); out = new ObjectOutputStream(fOut); out.writeObject(employee); //serializing System.out.println("An employee is serialized into c:\\emp.ser");
} catch(IOException e){ e.printStackTrace();
Q33 How do I deserilaize an Object? Ans To deserialize an object, perform the following steps: 1.Open an input stream 2.Chain it with the ObjectInputStream - Call the method readObject() and cast the returned object to the class that is being deserialized. 3.Close the streams Java Code try{ fIn= new FileInputStream("c:\\emp.ser"); in = new ObjectInputStream(fIn);
Q34 What is Externalizable Interface ? Ans: Externalizable interface is a subclass of Serializable. Java provides Externalizable interface that gives you more control over what is being serialized and it can produce smaller object footprint. This interface defines 2 methods: readExternal() and writeExternal() and you have to implement these methods in the class that will be serialized. In these methods you'll have to write code that reads/writes only the values of the attributes you are interested in. Programs that perform serialization and deserialization have to write and read these attributes in the same sequence.
Introduction to Classes and Methods
Q.1 Which is used to get the value of the instance variables? Ans Dot notation.
Q.2 The new operator creates a single instance named class and returns a reference to that object. a)True b)False Ans a.
Question:3) A class is a template for multiple objects with similar features. a)True b)False Ans: a.
Question:4) What is mean by garbage collection? Ans 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.
Question:5) What are methods and how are they defined? Ans 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.
Question:6) What is calling method? Ans Calling methods are similar to calling or referring to an instance variable. These methods are accessed using dot notation. Ex: obj.methodname(param1,param2)
Question:7) Which method is used to determine the class of an object? Ans Ther is method getClass( ) method in Class class. Which we can can be used to find out what class the belongs to. This class is defined in the object class and is available to all objects.
Question:8) All the classes in java.lang package are automatically imported when a program is compiled. a)True
b)False Ans a.
Question:9) How can class be imported to a program? Ans To import a class, the import keyword should be used as shown.; import packagename; e.g. import java.sql.*; We are importing here all classes. import java.sql.Connection ; In this way we are just importing Connection class here If we have import sub package then we have do as following : import r4r.co.in,*;
Question:10) Where we need to place import statement. Ans Import statement will be very first statements of any class or just before package statement.
Question:11) What is a constructor? Ans A constructor is a special kind of method that determines how an object is initialized when created.
Question:12) Which keyword is used to create an instance of a class? Ans new.
Question:13) Which method is used to garbage collect an object? Ans finalize ().
Question:14) Constructors can be overloaded like regular methods.
a)True b)False Ans a.
Question:15) What is casting? Ans Casting is converting the value of one type to another.
Question:16) Casting between primitive types allows conversion of one primitive type to another. a)True b)False Ans a.
Question:17) Casting occurs commonly between numeric types.
a)True b)False
Ans a.
Question:18) Boolean values can be cast into any other primitive type. a) True b) False Ans b.
Question:19) Casting does not affect the original object or value. a)True b)False Ans a.
Question:20) Which cast must be used to convert a larger value into a smaller one? Ans Explicit cast.
Question:21) Which cast must be used to cast an object to another class? Ans Specific cast.
Question: 22) Which of the following features are common to both Java & C++? A. The class declaration b. The access modifiers c. The encapsulation of data & methods with in objects d. The use of pointers Ans a,b,c.
Question:23) Which of the following statements accurately describe the use of access modifiers within a class definition?
a. They can be applied to both data & methods b .They must precede a class's data variables or methods c. They can follow a class's data variables or methods d .They can appear in any order e. They must be applied to data variables first and then to methods Ans a,b,d.
Question:24) Suppose a given instance variable has been declared private. Can this instance variable be manipulated by methods out side its class? a. Yes b.No Ans b.
Question:25) Which of the following statements can be used to describe a public method? a. It is accessible to all other classes in the hierarchy b. It is accessible only to subclasses of its parent class c. It represents the public interface of its class d. The only way to gain access to this method is by calling one of the public class methods Ans a,c.
Question:26) Which of the following types of class members can be part of the internal part of a class? a. Public instance variables b. Private instance variables c. Public methods d. Private methods Ans b,d.
Question:27) You would use the ____ operator to create a single instance of a named class. a. new b. dot Ans a.
Question:28) Which of the following statements correctly describes the relation between an object and the instance variable it stores? a. Each new object has its own distinctive set of instance variables . b. Each object has a copy of the instance variables of its class . c. The instance variable of each object are separate from the variables of other objects . d. The instance variables of each object are stored together with the variables of other objects . Ans a,b,c.
Question:29) If no input parameters are specified in a method declaration then the declaration will include __. a. An empty set of parentheses b. The term void Ans a.
Question:30) What are the functions of the dot(.) operator? a. It enables you to access instance variables of any objects within a class b. It enables you to store values in instance variables of an object c.It is used to call object methods d.It is to create a new object
Ans a,b,c.
Question:31) Which of the following can be referenced by this variable? a. The instance variables of a class only b.The methods of a class only c.The instance variables and methods of a class Ans c.
Question:32) The this reference is used in conjunction with ___methods. a. static b. non-static Ans b.
Question:33) Which of the following operators are used in conjunction with the this and super references? a.The new operator b.The instanceof operator c.The dot operator Ans c.
34) A constructor is automatically called when an object is instantiated a. true b. false Ans a.
Question 35) When a constructor be called without specifying arguments? a. When the default constructor is not called. b. When the name of the constructor differs from that of the class. c. When there are no constructors for the class. Ans c.
Question 36) Each class in java can have a finalizer method a. true b.false
Ans a.
Question:37) When an object is referenced, does this mean that it has been identified by the finalizer method for garbage collection? a.Yes b.No Ans: b.
Question:38) Because finalize () belongs to the java.lang.Object class, it is present in all
___. a.objects b.classes c.methods Ans b.
Question:39) Identify the true statements about finalization. a. A class may have only one finalize method b. Finalizers are mostly used with simple classes c. Finalizer overloading is not allowed Ans a,c.
Question:40) When you write finalize() method for your class, you are overriding a finalizer inherited from a super class. a.true b.false Ans a.
Question:41) Java memory management mechanism garbage collects objects which are no longer referenced? a true b.false Ans: a.
Question:42) are objects referenced by a variable candidates for garbage collection when the variable goes out of scope? a yes b. no Ans: a.
Question:43) Java's garbage collector runs as a ___ priority thread waiting for __priority threads to relinquish the processor. a.high b.low Ans a,b.
Question:44) The garbage collector will run immediately when the system is out of memory a.true b.false
Ans a. Question:45) You can explicitly drop a object reference by setting the value of a variable whose data type is a reference type to ___
Ans null
Question:46) When might your program wish to run the garbage collector? a. before it enters a compute-intense section of code b. before it enters a memory-intense section of code c. before objects are finalized d. when it knows there will be some idle time Ans a,b,d
Question:47) For externalizable objects the class is solely responsible for the external format of its contents? a.true b.false Ans a
Question:48) When an object is stored, are all of the objects that are reachable from that object stored as well? a.true b.false Ans a
Question:49) The default__ of objects protects private and transient data, and supports the __ of the classes a. evolution b. encoding Ans: b,a.
Question:50) Which are keywords in Java? a) NULL b) sizeof c) friend d) extends e) synchronized Ans d and e
Question:51) When must the main class and the file name coincide? Ans When class is declared public.
Question:52) What are different modifiers?
Ans There are following different modifiers in java: public, private, protected, default, static, transient, volatile, final, abstract.
Question:53) What are different access modifiers?
Ans : public, private, protected, default.
Question:54) What is meant by "Passing by value" and " Passing by reference"? Ans Passing objects pass by reference passing primitive values into methods - pass by value
Question:55) Is a class a subclass of itself? Ans :Yes . A class is a subclass itself.
Question:56) What modifiers may be used with top-level class? Ans : public, abstract, final.
Question:57) What is an example of polymorphism? a. Inner class b. Anonymous classes c. Method overloading d. Method overriding Ans : c
Introduction to Classes and Methods Question:58) What are methods and how are they defined? Ans 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.
Question:59) What is calling method? Ans Calling methods are similar to calling or referring to an instance variable. These methods are accessed using dot notation. Ex: obj.methodname(param1,param2) Question:60) Which method is used to determine the class of an object? Ans Ther is method getClass( ) method in Class class. Which we can can be used to find out what class the belongs to. This class is defined in the object class and is available to all objects. Question:61) How can class be imported to a program? Ans To import a class, the import keyword should be used as shown.;
import packagename; e.g. import java.sql.*; We are importing here all classes. import java.sql.Connection ;
In this way we are just importing Connection class here If we have import sub package then we have do as following : import r4r.co.in,*; Question:62) Where we need to place import statement. Ans Import statement will be very first statements of any class or just before package statement.
Question:63) What is a constructor?
Ans A constructor is a special kind of method that determines how an object is initialized when created. Question:64) What is casting? Ans Casting is convert the value of one type to another. Question:65) What are different modifiers? Ans There are following different modifiers in java: public, private, protected, default, static, transient, volatile, final, abstract.
Question:66) What are different access modifiers? Ans : public, private, protected, default. Packages and interface Question 67) What are packages ? what is use of packages ? Ans :The package statement defines a name space in which classes are stored.If you omit the package, the classes are put into the default package. Signature... package pkg; Use: * It specifies to which package the classes defined in a file belongs to. * Package is both naming and a visibility control mechanism.
Question 68) What is difference between importing "java.applet.Applet" and "java.applet.*;" ?
Ans :"java.applet.Applet" will import only the class Applet from the package java.applet Where as "java.applet.*" will import all the classes from java.applet package.
Question 69) What do you understand by package access specifier? Ans : public: Anything declared as public can be accessed from anywhere private: Anything declared in the private cant be seen outside of its class. default: It is visible to subclasses as well as to other classes in the same package.
Question 70) What is interface? What is use of interface? Ans : It is similar to class which may contain methods signature only but not bodies. Methods declared in interface are abstract methods. We can implement many interfaces on a class which support the multiple inheritance.
Question 71) Is it is necessary to implement all methods in an interface? Ans : Yes. All the methods have to be implemented.
Question 72) Which is the default access modifier for an interface method? Ans : public.
Question 73) Can we define a variable in an interface ?and what type it should be ? Ans : Yes we can define a variable in an interface. They are implicitly final and static.
Question 74) What is difference between interface and an abstract class? Ans : All the methods declared inside an Interface are abstract. Where as abstract class must have at least one abstract method and others may be concrete or abstract. In Interface we need not use the keyword abstract for the methods. Data types, variables and Arrays Question:75) What is meant by variable? Answer: Variables are locations in memory that can hold values. Before assigning any value to a variable, it must be declared.
Question:76) What are the kinds of variables in Java? What are their uses? Answer: Java has three kinds of variables namely, the instance variable, the local variable and the class variable. Local variables are used inside blocks as counters or in methods as temporary variables and are used to store information needed by a single method. Instance variables are used to define attributes or the state of a particular object and are used to store information needed by multiple methods in the objects. Class variables are global to a class and to all the instances of the class and are useful for communicating between different objects of all the same class or keeping track of global states.
Question:77) How are the variables declared? Answer: Variables can be declared anywhere in the method definition and can be initialized during their declaration. e.g. int i; //declare the variable. i=0; //Initialize the variable They are commonly declared before usage at the beginning of the definition. Variables with the same data type can be declared together. Local variables must be given a value before usage.
Question:78) What are variable types? Answer: Variable types can be any data type that java supports, which includes the eight primitive data types, the name of a class or interface and an array.
Question:79) How do you assign values to variables?
Answer: Values are assigned to variables using the assignment operator =. e.g. int i=0; int i; i=0;
Question:80) What is a literal? How many types of literals are there? Answer: A literal represents a value of a certain type where the type describes how that value behaves. There are different types of literals namely number literals, character literals, boolean literals, string literals, etc.
Question:81) What is an array? Answer: An array is an object that stores a list of items with same data type.
Question:82) How do you declare an array? Answer: Array variable indicates the type of object that the array holds.
Ex: int arr[];
Question:83) Java supports multidimensional arrays. a)True b)False Answer: b. Java Support Array of array. This mean we can assign an array into other to make multidimensional. array.
Question:84) An array of arrays can be created. a)True b)False Answer: a.
Question:85) What is a string? Answer: A combination of characters is called as string. The is a String class into lava.lang.* package which is used to wrap any character to make a string. Exception Handling
Question 86) What is the difference between throw and throws ?And its application? Ans : Exceptions that are thrown by java runtime systems can be handled by Try and catch blocks. With throw exception we can handle the exceptions thrown by the program itself. If a method is capable of causing an exception that it does not handle, it must specify this behavior so the callers of the method can guard against that exception.
Question 87) What is the difference between Exception and error in java? Ans : Exception and Error are the subclasses of the Throwable class. Exception class is used for exceptional conditions that user program should catch. With exception class we can subclass to create our own custom exception. Error defines exceptions that are not excepted to be caught by you program. Example is Stack Overflow.
Question 88) What is Resource leak? Ans : Freeing up other resources that might have been allocated at the beginning of a method.
Question 89)What is the finally block? Ans : Finally block will execute whether or not an exception is thrown. If an exception is thrown, the finally block will execute even if no catch statement match the exception. Any time a method is about to return to the caller from inside try/catch block, via an uncaught exception or an explicit return statement, the finally clause is also execute.
Question 90) Can we have catch block with out try block? If so when? Ans : No. Try/Catch or Try/finally form a unit.
Question 91) What will happen to the Exception object after exception handling? Ans : It will go for Garbage Collector. And frees the memory.
Question 92) How many Exceptions we can define in throws clause? Ans : We can define multiple exceptions in throws clause. Signature is.. Type method-name (parameter-list) throws exception-list Multi Threading Question 93) What is meant by timeslicing or time sharing? Ans : Timeslicing is the method of allocating CPU time to individual threads in a priority schedule. Question 94) What is meant by daemon thread? In java runtime, what is it's role? Ans : Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system .
UNIT IV
Q.1 What is E- Governance, give some examples of project running in India for E- Governance. Ans: E-Governance' is a network of organizations to include government, nonprofit, and private-sector entities; in e-governance there are no distinct boundaries. The model for e-governance is a one-stop portal, where citizens have access to a variety of information and services. An ideal portal would be one for employment where a citizen creates a profile and is presented with employment opportunities at the federal, state, local, non-profit, and private-sectors; currently websites like monster.com over these services but more often than not users are required to reenter their information for the specific job. However, not all stakeholders have the same desired end-state which inhibits the possibility of a one-stop portal.
Major Examples of E-Gov project Portal 1. MAC 21, Indias Prestigious G2B service Portal (www.mac.gov.in) 2. Income Tax Portal (www.Incometaxindia.gov.in) 3. DRDO , Department of Defense (www.drdo.nic.in) 4. India Courts (www.indiacourt.nic.in) 5. National portal of India (www.rti.gov.in)
Q.2 What is E-business, with examples. Or what is E-commerce with Examples. Or Difference Between E-commerce and E-business. Ans : Electronic business, commonly referred to as "ebusiness" or "e-business", may be defined as the application of information and communication technologies (ICT) in support of all the activities of business. Commerce constitutes the exchange of products and services between businesses, groups and individuals and can be seen as one of the essential activities of any business. Electronic commerce focuses on the use of ICT to enable the external activities and relationships of the business with individuals, groups and other businesses. Electronic commerce, commonly known as e-commerce or ecommerce, or e- business consists of the buying and selling of products or services over electronic systems such as the Internet and other computer networks. The amount of trade conducted electronically has grown extraordinarily with widespread Internet usage. The use of commerce is conducted in this way, spurring and drawing on innovations in electronic funds transfer, supply chain management, Internet marketing, online transaction processing, electronic data interchange (EDI), inventory management systems, and automated data collection systems. Examples: 1. IRCTC portal: Railway website for ticketing in india. (www.irctc.co.in)
2. Life insurance corporations of india portal for premier insurance. (www.licindia.com) 3. E- banking Site of varipur bank Such as 3.1 www.statebankofindia.com 3.2 www.bankofindia.com
Advantages of E-business and E-commerce 1. Improved speed of response 2. Cost Saving 3. Improved Efficiency and productivity 4. Improved customer service.
Q. Define E-learning with its application. Ans: E-learning includes all forms of electronically supported learning and teaching, which are procedural in character and aim to effect the construction of knowledge with reference to individual experience, practice and knowledge of the learner. Information and communication systems, whether networked or not, serve as specific media to implement the learning process. In E-learning it is essentially that computer and network enabled transfer of skills and knowledge. E-learning refers to using electronic applications and processes to learn.
E-learning advantages 1. Increased access, and Improved performance. 2. Convenience and flexibility to learners: learning is self-paced and the learning sessions are available 24x7. 3. To develop the skills and competencies needed in the 21st century, in particular to ensure that learners have the digital literacy skills required in their discipline, profession or career. 4. Pay less per credit hour 5. Reduce overall training time 6. Bookmark progress (computer remembering where the student left off so they can resume the courses from there) 7. Remain in one location (e.g., home, office, airport, coffee shop, etc.) With no need to travel (also reduces the cost of transportation to physical classrooms and benefits environment). 8. Access courses from a variety of locations .
Q.4 What is GUI, with its application Ends. Ans : A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than typing such as computers; hand-held devices such as MP3 players, portable media players or gaming devices; household appliances and office equipment with images rather than text command.
Advantages and Disadvantages of guis Advantages - it can be user-friendly and speed up the user's work. - it can be more attractive for non-technical people. - in general, it looks more professional (but this does not mean it is always the best solution).
Disadvantages - when it is not properly built, it can be very difficult to work with. - it generally requires more memory resources than a non-graphical one. - it might require the installation of additional software, e.g., the "runtime environment" in the case of java. - depending on the programmer, it might require more time to be implemented
GUI defines two ends of the application Front-end and back-end.Front end and back end are generalized terms that refer to the initial and the end stages of a process. 1. The front end is responsible for collecting input in various forms from the user and processing it to conform to a specification the back end can use. 2. Backend : the backend is the end that is not visible but that processes the user requests as received by the front-end. The front end is an interface between the user and the back end.
Q. 6 Describe Backend database. Ans Database is a collection of (usually) organized information in a regular structure, usually but not necessarily in a machine-readable format accessible by a computer; A software program for storing, retrieving and manipulating database. A back-end database is a database that is accessed by users indirectly through an external application rather than by application programming stored within the database itself or by low level manipulation of the data.
Q. 7 Data Base Development Life.
Ans
1. Database Planning Focus here is on management activities Activities include: Work to be done Resources available Tors Surely we can spend a few minutes before rushing off to spend our money or write programs. Isnt that extra hesitation the essence of design Gerald Weinberg 2. System Definition Scope Parameters Application areas User groups 3. Information Needs/Requirements Analysis Goal: to communicate information in ways that are relevant to the recipient group A process of: Discovery, Refinement, Modelling, Specifications 4. Requirements Discovery Methods Collecting facts from existing documentation Research and site visits Questionnaires Interviews
Discovery prototyping
5. Goals of Requirements Analysis To determine the data requirements of the database in terms of primitive objects To classify and describe the information about these objects To identify and classify the relationships among the objects To determine the types of transactions that will be executed on the database and the interactions between the data and the transactions To identify rules governing the integrity of the data 6. Database design and Database Design Framework The process of creating a design for a database that will support the enterprises Operations and objectives Determine the information requirements Analyse the real-world objects that you want to model in the database Determine primary key attributes Develop a set of rules that govern how each table is accessed, populated and Updated. Identify relationship between the entities Plan database security 7. Database Maintenance Objectives: Fix bugs (incorrect program specs or code) in software, add enhanced functions, cycle back through SDLC phases as needed for small- scale projects End Result: Fully Functional Robust System Methods: As needed for phases above; audit the system How to Avoid Risk: Watch changing business requirements, set priorities.
Q. 7 What is ER Model, describe with Entity, Relationships, Attributes in detail. Ans: The Entity-Relationship (ER) model was originally proposed by Peter in 1976 as a way to unify the network and relational database views. The ER Diagrams is the initial process to analysis a database application and understands the problems related or causes in future with the choosed database application in this stage different components are watched and studied by the dba's and a diagrammatical model is designed by describing entities attributes relationships constraints and some important things related with project data management and data storage there some unique type drawing shapes are used while design the ER- Diagram those shape are defines the various parts of your DB Application. It Must be designed first before going to start minor to major project of work environment and deeply catch everything and also the future scope of the project application. There are three basic elements in ER models:
Entities are the "things" about which we seek information. Attributes are the data we collect about the entities. Relationships provide the structure needed to draw information from multiple entities.
Entity: Real-world object distinguishable from other objects. An entity is described (in DB) using a set of attributes. Entity Set: A collection of similar entities. E.g., all employees. All entities in an entity set have the same set of attributes. (Until we Consider ISA hierarchies, anyway!) Each entity set has a key. Each attribute has a domain.
Relationships: Relationship instancelink between entities (corresponds to primary key- foreign key equivalencies in related tables) Relationship typecategory of relationshiplink between entity types
Relationship: Association among two or more entities. E.g., Gandalf works in the Pharmacy department. Relationship Set: Collection of similar relationships. v Similarity: is in terms of entity sets where the entities are from. v E.g.: A person (from employees entity set) works in a department (from Departments entity set). v An n-ary relationship set R relates n entity sets E1 ... En; each relationship in R involves entities e1 in E1,...,en in En Employee s ssn name lot
v Same entity set could participate in different relationship sets, or in different roles in same set
Degree of a Relationship Set 1. Refers to number of entity sets that participate in a relationship set. 2. Relationship sets that involve two entity sets are binary (or degree two). Generally, most relationship sets in a database system are binary. 3. Relationship sets may involve more than two entity sets. Example: Suppose employees of a bank may have jobs (responsibilities) at multiple branches, with different jobs at different branches. Then there is a ternary relationship set between entity sets employee, job, and branch 4. Relationships between more than two entity sets are rare. Most relationships are binary. (More on this later.)
Attributes: An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. v Relationships can have attributes v These attributes are called descriptive attributes, because they only describe relationships, but do not distinguish relationships. Example: customer = (customer_id, customer_name, customer_street, customer_city ) loan = (loan_number, amount )
Domain the set of permitted values for each attribute Attribute types: 1. Simple and composite attributes. 2. Single-valued and multi-valued attributes Example: multivalued attribute: phone_numbers 3. Derived attributes i. Can be computed from other attributes Relationship Set Example lot dname budget did since name Works_In Departments Employees ssn Relationship set: Works_In
ii. Example: age, given date_of_birth
Composite Attributes
Mapping Cardinality Constraints 1. Express the number of entities to which another entity can be associated via a relationship set. 2. Most useful in describing binary relationship sets. 3. For a binary relationship set the mapping cardinality must be one of the following types: a. One to one b. One to many c. Many to one d. Many to many
One to One one to many Note: Some elements in A and B may not be mapped to any elements in the other set
Keys of Entity Sets A superkey of an entity set is a (sub)set of the attributes such that no two entities in the set is allowed to have the same values on all these (key) attributes. Candidate key, A superkey that does not have a redundant attribute, i.e., if any attribute is removed, the set is not a superkey anymore.
Primary key, One of the candidate keys designated to be so. Keys for Relationship Sets 1 The combination of primary keys of the participating entity sets forms a super key of a relationship set. (customer_id, account_number) is the super key of depositor NOTE: this means a pair of entity sets can have at most one relationship in a particular relationship set. Example: if we wish to track all access_dates to each account by each customer, we cannot assume a relationship for each access. We can use a multivalued attribute though 2 Must consider the mapping cardinality of the relationship set when deciding what the candidate keys are. 3 Need to consider semantics of relationship set in selecting the primary key in case of more than one candidate key. E-R Diagrams
1 Rectangles represent entity sets. 2 Diamonds represent relationship sets. 3 Lines link attributes to entity sets and entity sets to relationship sets. 4 Ellipses represent attributes a. Double ellipses represent multivalued attributes. b. Dashed ellipses denote derived attributes. 5 Underline indicates primary key attributes (will study later)
E-R Diagram With Composite, Multivalued, and Derived Attributes
Q. 8 What is Cardinality Constraints, describe in details. 1. We express cardinality constraints by drawing either a directed line (), signifying one, or an undirected line (), signifying many, between the relationship set and the entity set. 2. One-to-one relationship: a. A customer is associated with at most one loan via the relationship borrower b. A loan is associated with at most one customer via borrower
One-To-Many Relationship 1. In the one-to-many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrower
Many-To-Many Relationship 1. A customer is associated with several (possibly 0) loans via borrower 2. A loan is associated with several (possibly 0) customers via borrower
Participation of an Entity Set in a Relationship Set 1. Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set a. E.g. participation of loan in borrower is total i. every loan must have a customer associated to it via borrower 2. Partial participation: some entities may not participate in any relationship in the relationship set a. Example: participation of customer in borrower is partial
Q. 9 Describe E-R Diagram with a Ternary Relationship. Ans:
1. We allow at most one arrow out of a ternary (or greater degree) relationship to indicate a cardinality constraint 2. E.g. an arrow from works_on to job indicates each employee works on at most one job at any branch. 3. If there is more than one arrow, there are two ways of defining the meaning. a. E.g a ternary relationship R between A, B and C with arrows to B and C could mean 1. each A entity is associated with a unique entity from B and C or b. 2. each pair of entities from (A, B) is associated with a unique C entity, and each pair (A, C) is associated with a unique B c. Each alternative has been used in different formalisms d. To avoid confusion we outlaw more than one arrow
Q. 10 Define the symbols used in ER diagrams. Ans:
Q. 11 What is Weak entity Set describe with exmaple. Ans: An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the existence of an identifying entity set it must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity set Identifying relationship depicted using a double diamond The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set. The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity sets discriminator. 1.We depict a weak entity set by double rectangles. 2.We underline the discriminator of a weak entity set with a dashed line. 3.payment_number discriminator of the payment entity set 4.Primary key for payment (loan_number, payment_number)
Q. 13 Define D De es si ig gn n C Co on ns st tr ra ai in nt ts s o on n a a S Sp pe ec ci ia al li iz za at ti io on n/ /G Ge en ne er ra al li iz za at ti io on n Ans: D De es si ig gn n C Co on ns st tr ra ai in nt ts s o on n a a S Sp pe ec ci ia al li iz za at ti io on n/ /G Ge en ne er ra al li iz za at ti io on n Constraint on which entities can be members of a given lower-level entity set. condition-defined Example: all customers over 65 years are members of senior-citizen entity set; senior-citizen ISA person. user-defined Constraint on whether or not entities may belong to more than one lower-level entity set within a single generalization. Disjoint an entity can belong to only one lower-level entity set Noted in E-R diagram by writing disjoint next to the ISA triangle
Overlapping an entity can belong to more than one lower-level entity set
Completeness constraint -- specifies whether or not an entity in the higher-level entity set must belong to at least one of the lower-level entity sets within a generalization. total : an entity must belong to one of the lower-level entity sets partial: an entity need not belong to one of the lower-level entity sets
A Computer Network Is A Group of Computer Systems and Other Computing Hardware Devices That Are Linked Together Through Communication Channels To Facilitate Communication and Resource
Hacking With Kali Linux : A Comprehensive, Step-By-Step Beginner's Guide to Learn Ethical Hacking With Practical Examples to Computer Hacking, Wireless Network, Cybersecurity and Penetration Testing