eBook features: Highlight, take notes, and search in the book; Page numbers are just like the physical edition; Format: Print Replica; Due to its large file size, this. A Text Book on INFORMATICS PRACTICES. (Class XII). To Download Click Following link: Part Courtesy: CBSE. << Go Back To Main Page · Downloads. A Text Book on Informatics Practices. (Class XI). Contents: INFORMATICS PRACTICES. suiswanlegitil.mlRE CONCEPTS; suiswanlegitil.mlRE CONCEPTS.

Informatics Practices Class 12 Ebook

Language:English, French, Dutch
Country:Korea South
Genre:Politics & Laws
Published (Last):06.10.2015
ePub File Size:28.74 MB
PDF File Size:17.87 MB
Distribution:Free* [*Registration needed]
Uploaded by: DEVORAH

Download latest NCERT Book for Class 12 Informatics Practices. The books can be download in pdf format for Class 12 Informatics Practices. Download entire. CBSE Books -Class XIIDownload ePub Reader · Home · Classes I-V · Classes VI -VIII · Classes Informatics Practices. Class: XII. Lang: English. Sub: IT. book. Ip Book for Class Xii - Cbse - Free ebook download as PDF File .pdf), Text File . txt) or read book The text book of Informatics Practices for Class XII is ready.

The default value of char type variable is To get the round off value of x variable, we can use.. What is RAD? How are events, message, methods and properties interrelated? Compare the following? What do you mean by Scope of variables? Explain with an example. What are operators? Discuss briefly different types of operators available in Java. How may times are the following loops executed? Find the output of the following code fragments? What is GUI programming? How is swing related to GUI programming?

What is an event? What is event handler? What is the default name of action event handler of a button namely TestBtn? What property would you set to assign access key to a button? Which method can programmatically performs the click action of a push button? Which method returns the password entered in a password field? Which list property do you set for specifying the items for the list. Which method would you use to determine the index of selected item in a list? Which method would you use to insert an item at specified index, in the list?

How you can determine whether 5th item in a list is selected or not? Which property you will set to ensure that only one item gets selected in a list. Which method you would use to insert Hello at 10th position in the Text Area control. Which method you would like to use to insert an Icon picture on a Push Button. Which method would you like to hide a push button jButton1.

Which Event Handler method would you like to run with a list to handle its items selections?

Which property would you like to set to make a Combo editable? What is Layout Manager? Discuss briefly about layout managers offered by NetBeans? Name three commonly used properties and methods of the following controls. What is dispose used for? What is the significance of following properties of a text area?

What is the significance of a button group? How do you create a button group? Discuss about some commonly used properties of lists and a combo boxes. What methods obtains the current selection of a combo box? Give a code example. Identify the error in following code that is written in action event handler of a button namely OKBtn.

What is the role of a return statement in a method? How many values can be returned? What is composite data type? What is user defined data type?

Can every class be referred to as a user-defined data type? What is this keyword? What is its significance? Define a method. What is method prototype and signature? Discuss some advantages of using methods in a program. How are parameterized constructors different from non-parameterized constructors? List some of the special properties of the constructor methods. Differentiate between Instance member and static members of a class.

What do you mean by actual and formal parameters of a method? Given the method below write an ActionPerformed event method that includes everything necessary to call this method. Write a method in Java to do the following assume method name and parameter yourself a. A method takes two integer numbers and returns sum of them.

A method that takes an integer number and returns 1 if it is even otherwise returns 0. A method takes an integer parameter and returns its factorial e.

download for others

A method takes an integer parameter and returns true if number is prime otherwise returns false. A method that takes two integer arguments and returns 0 if both the arguments are equal, return -1 if the first argument is smaller than the second and 1 if the second argument is smaller than the first? We would like to make a member of a class visible in all subclasses regardless of what package they are in.

Which key words would achieve this? What will be the scope of: a A public class c A protected class? What does round return if a negative float value is passed to it? What are use of pow and round method of math library , with an example?

Name the package you need to import for performing input and output. Which package is by default imported in every Java program? What is the difference between equals and equalIgnorecase string functions? What is the difference between length and capacity string functions? Which command creates a package in java? What is friendly access of class member? How are private members different from public members of a class? How are protected members different from public and private members of a class?

How does a class enforce information hiding? Write a program to extract a portion of character string and print the extracted string. Assume that m characters are extracted, starting with nth character? Write a program, which will read a text and count all occurrences of a particular character. How do we design a package? Define a class for date with required data members like day, month, year and functions like constructors, printing a date, validating a date etc. Using the above defined class date create two objects such as birthDate and joinDate.

Define a class named Book with the following details- assume data type your self Data members- Title, Author, Subject, Edition and Price. Method MembersDisplay to display the details of the book. Parameterized constructor method to initialize data members with given value. Non-parameterized constructor to initialize String data members with and numeric members with 0. Discuss its various forms.

How are these related? Define Inheritance? Why it is an important concept of in object Oriented Languages. How does the visibility mode control the access of members in the derived class? Explain with examples. What is the difference between protected and private members? How are arguments sent to the base constructors in multiple inheritances?

Explain with suitable code example? If a base class as well as its derived class contain a member function with the same name, say func , can an object of the derived class access both these functions i. Define an abstract class and abstract methods. What is an interface? What is the use of Interface. What do you mean by Overriding Methods and Hiding Member variables? What do you mean by Method Overloading? What conditions to fulfilled to overload a method?

We know that a private member of a base class is not directly accessible by a subclass. Is it anyway possible for the objects of a derived class to access the private members of the base class? If yes, how? Remember, the base class cannot be modified. What is a dialog? What all classes can you use to create dialogs in Java? Name them. Which component of Swing Windows lets you create a general purpose dialog? Which component of Swing Windows lets you create built in dialog styles?

How many dialog types does Java support? Which import command do you need to write before creating an Option Pane dialog window? Which method would you invoke to display i message dialog ii confirm dialog iii input dialog? Which methods are used to insert and remove rows from an existing table? How do you provide data to a table?

What type of value is returned by Confirm Dialog? What is the difference between a general purpose dialog JDialog type dialog and a pre-defined dialog JOptionPane type dialog? Write command to display a message dialog to display prompt as Hello World, title as My dialog and icon as question icon. By default, what all buttons are shown by : i Confirm dialog ; ii Message dialog ; iii Input dialog 4.

Write code fragment to obtain a number from user and display whether it is odd or even. Make use of dialogs only. Write code fragment to obtain a temperature-value in degree Fahrenheit and display it in Celsius. Write code to add a row to a table atbl containing details number, square. Write code to remove first and last row of a table namely atbl. What is a Table Model? What is its role in a Table control? What is a connection? What does Class.

What is result set? What does DriverManager do? Which methods are used to execute SQL queries? Write a statement to register driver com.

Driver with DriverManager? Name the methods for the following? Which package must be import to implement databse connection? What all task are performed using JDBC? What is following code doing? What are steps to connect to a database from with java application? What is difference between executeQuery and executeUpdate method.? Write code to a mysql database namely school and then fetch all those records from table student where grade is A. Find errors in the following code : Import java. What do you mean by Web Browser, and Web Server?

What is WWW? How does it function? Comment on these statements? What is URL? What are its components? What is CGI? How it works in Dynamic web Page service?

Differentiate between Static and Dynamic Web Service? Assignment No. What is HTML? Why it is used? What is Tag? Differentiate between Container and Empty tag? What is an Attribute? Write the HTML code for the followings.

What types of list are supported by HTML? Which three tags let you create the definition list? Which three tags let you create the i un numbered lists? What is a table?

Which tag is used to create tables in HTML? Which attributes are used to give border to a table? Which attribute lets you control the display of select border sides of a table? Which attributes is used to control the inside table border? How is spacing in cells of table controlled? How can you specify following in table? What tag is used to specify i Table data ii Table header iii Table row?

Name the attributes used for following? What are forms? Which methods and actions are commonly used with Forms? Name different control types supported by HTML forms. How will you nest an un order list inside an ordered list? How would you indent a single word and put a square bullet in front of it? Write code to produce following HTML tables?

What is XML? What do you mean by Extensible in XML?. Name some markup language based on XML. What is prolog? What is data instance? Write some features of XML. What is valid document? Name a meta-language? What is the role of Style sheet in XML file system? Define the following terms: I DBMS ii View iii data security iv data integrity v Relation vi domain vii tuple viii attribute ix Degree x cardinality 1.

What is data redundancy? What are the problems associated with it? What is data model? Name various data model? How do database management systems ensure data security and privacy? What do you mean by referential Integrity? How it is enforced in DBMS? What is Key? What types of commands are used in the following categories?

DDL 2. DML 3. TCL 4. System control commands 7. What do you mean by Data dictionary? What it consist of? What is data type? Name some data types available in MySQL. Compare Char and Varchar data types? Which keyword eliminates the redundant data from a query result? How would you display system date as the result of a query? Which function is used to substitute Null values in a query result?

Which operator concatenates two strings in a query result? What command is used for1. To view the table structure. Which comparison operator is used for comparing? A threat to data security b. Not a threat to data security c. Good for laptops d. A topology 8. A repeater a.

Regenerates the received signal b. Destroys the received signal c. Can be used as a hub d. None of the above 9. Satellite links are generally used for a. PANs b. LANs c. MANs d. All of the above A domain name maps to a. A URL b. An IP address c. A website d.


All of the above 1. What is a computer network? What are its advantages? What is meant be communication channels?

Give two examples of guided media and two examples of unguided media. Setting up a LAN b. Transfer of data from a laptop to a mobile phone. Transfer of data from one mobile phone to another. Creating a remote control that can control multiple devices in a home. Very fast communication between two offices in two different countries.

Communication in a hilly area g. Communication within a city and its vicinity where cost of cabling is too high. Why is a switch called an intelligent hub? When is a repeater used in a computer network? Diagramatically show how would you connect 6 PCs, 1 server, 1 printer, and 2 scanners in a. Star topology b. Bus topology 7. Two engineers in the same room have connected their Palm-tops using bluetooth for working on a Group presentation.

Out of the following, what kind of Network have they formed? What is a MAC address? Give some examples of domain names and URLs.

How is a domain name different from a URL? What is domain name resolution? Define Network security? What kind of attacks can be made on data and computer networks? List some methods which are used for network security.

Differentiate with examples wherever possible between: Hub and Switch d. Guided and Unguided media Write one advantage of star topology over bus topology and one advantage of bus topology over star topology. Ishika Industries has set up its new production unit and sales office at Ranchi. The company compound has 4 buildings as shown in the diagram below: Suggest a cable layout of connections between the buildings so that each building is directly connected to Administrative Office.

Suggest the most suitable place i. Suggest the placement of the following devices with justification: The Administrative office of this unit is to be linked with the head office situated in Patiala Punjab. What will be the most economical way to do this? Justify your answer. Find the IP addresses of at least five computers in your school.

Find the MAC addresses of at least 2 computers in your lab.

(Download) CBSE Text Books: A Text Book on Informatics Practices (Class XI)

Then verify their manufacturer's name on the net. Find the layout of LAN in your school's labs. If you think some modifications can be done in the layout, note these down in your notebook. Find the name of Internet Service Provider of your school. Find the IP address of your school's web site. Team size recommended: A school building is divided into 4 blocks A, B, C, and D.

Each block is at a distance of 25m from its adjacent blocks. Each block has 1 computer lab with 15 computers each. Each block also has some other rooms maximum 10 with 1 computer each.

The school has only one internet connection. The computer network in the school has to be restructured with the following goals in mind: Each lab has to have an independent LAN. All the computers in the school should have internet access. The school does not want to have any other new internet connection. For internet access a computer should be dependent only on one point and not on multiple points. It means that if the internet connection is active, any computer should be able to access it directly irrespective of whether some other computer in the school is ON or OFF.

Any two computers in the school should be able to communicate with each other irrespective of whether any other computer in the school is ON or OFF. The job of each team is to design a layout for this new network structure. Each team has to specify The layout of the network structure diagrammatically.

How the design will be able to fulfill all the mentioned requirements. Find the average price and specifications of each of the following network devices in the market: Each team has to specify: Different types of switches available in the market, their prices, and number of ports. Names of brands of UTP Cable available in the market, along with their prices.

Different types of LAN cards available in the market along with their prices. Computers and internet have transformed our lives. It is next to impossible to modify the compiled version of the software. At times we feel the need to change certain features of the software but are unable to do so.

In this chapter we will study about software which are developed collaboratively and they can be modified as well. Well, have you noticed something common in all these terms. That's right! It is the word free. People often correlate this word with the cost. They think that these software are available for free.

Practically, these software can be acquired at very little or no cost. But, here, "free" means freedom to use. These software can be studied, copied, redistributed freely and even modified according to one's need without seeking any kind of permission.

In order to modify such software the developers also provide the source code to the users. There do exist software which are actually "free" in the sense of price.

These are known as Freeware. Lots of freeware can be downloaded from the internet for various different purposes such as currency converters, drawing graphs and charts etc. But freeware may not come with the source code. Therefore freeware differ from free software. The focus in this chapter is on free software rather than freeware.

The first formal definition of "free software" was given in by Richard Stallman, a long time member of the hacker community at the MIT Artificial Intelligence Laboratory. He insisted that a free software should give the following four freedoms to users: Freedom 0: The freedom to run the program for any purpose. Freedom 1: The freedom to study how the program works, and change it to make it do what you wish. Freedom 2: The freedom to redistribute copies so as to help your neighbour.

Freedom 3: The freedom to improve the program, and release your improvements and modified versions in general to the public, so that the whole community benefits. You can get more information on open source software from opensource. Operating systems and Desktop environments Linux - Operating system kernel Ubuntu - Linux distribution with full complement of software for everyday use.

Songbird - similar to iTunes with built-in browser. Comparable to Microsoft Office. Unix-like operating systems are built from a collection of libraries, applications and developer tools, plus a kernel to allocate resources and to talk to the hardware. GNU is often used with the Linux kernel.

Firefox is a free and open source web browser produced by Mozilla Foundation. Open Office is the leading open source office suite for word processing, spreadsheets, presentations, databases etc.

It is available in many languages. It stores files in open document format ODF for data interchange that is its default file format. The NetBeans community has since continued to grow, thanks to individuals and companies using and contributing to the project. A commonly voiced concern about open source software: Open Source Software Security "If anyone can contribute to open source software, doesn't it become a free-for-all full of loopholes? Getting a change incorporated into an open source project is thus rather like getting an article published in a scientific journal.

Open source software is more heavily tested than their commercial counterparts as it can be downloaded by anybody around the world and any one of them can discover a bug or security flaw and submit those reports back to the project. Also the loop-hole or bug is available to every one and the customer can take the preventive measure accordingly and fix comes faster. The Open Document format ODF is a format for office documents, such as spreadsheets, databases, presentations and word-processing documents.

Open Document is a free and open format. For governments, businesses, archivists and others, it's critical to store documents in a way that can be read for years to come. Proprietary digital file formats are typically changing with every new version of the software, so there should be some format which supports files created in any application. The data should be the center of importance not the application.

Office suite applications, as always, need a file format that is designed to organize the data when it moves away from the application. People with different machines in different places should be able to open and edit the data in a file. ODF offers an open alternative to the formats used by all of the existing Office application versions for text, spreadsheet, presentation, and other kinds of documents. Open Document's main file extensions are. These will be more commonly recognized when more people and organizations adopt Open Document-ready software.

Ogg Vorbis is a new audio compression format developed by Xiph. It is an open, patent-free, professional audio encoding and streaming technology with all the benefits of Open source. Let us recall from Annexure I of Class XI that in order to communicate with the computers some kind of a binary code is required.

In this regard, a detailed study was made on BCD code which is a 4 bit code. However, BCD code is not sufficient enough to accommodate even all the characters of English alphabet and digits. To accommodate all these, a higher bit code is required. In the earlier days most computers were using an 8 bit system. This extra bit gave computer developers lot of empty spaces which was used for different purposes.

In order to work with Indian languages, these unspecified spaces were used for Indic characters. The efforts were very creative and gave good results despite the fact that there was no or very little support from the operating systems. Since no general rules and methodologies were adopted in developing Indic characters, different developers developed these characters in their own ways.

This created compatibility issues across different programs and across different operating systems. For example browsers like Internet Explorer did not support all Indic characters and displayed distorted texts. On one hand, more and more work had been undertaken to facilitate the use of Indian languages on computers but on the other hand it was becoming difficult to maintain consistency across different programs developed for the same set of Indic characters.

In such a scenario, it was important to have a common standard for coding Indian scripts. The Indic scripts are a family of abugida alphabetic-syllabary writing systems. They are used by languages of several linguistic families: They were also the source of the dictionary order of Japanese kana.

Similarly, to work with other languages of the world, people were making efforts to use ASCII along with the extra 8th bit.

Unicode was developed with the aim to conceive a single standard code which could manage to represent all languages of the world. Unicode characters are represented in one of the three encoding forms: With the usage of Unicode, single versions of software were developed instead of language-specific versions that reduced the complexity.

This ensures platform, vendor and application independence. Incorporating Unicode into applications and websites offers significant cost savings than proprietary solutions. It allows data to be transported through several different systems without distortion. This font format was developed by Adobe in 's. This font consists of two parts which are both necessary for the font to be properly printed and displayed on screen.

With most operating systems, these fonts can be installed simply by being placed in the system's folder. This format was jointly developed by Apple and Microsoft in the late 80s. These fonts contain both the screen and printer font data in a single component, making the fonts easier to install. And that is why these are a good choice for those who find the installation of fonts difficult. This is the latest font format which is a joint effort by Apple and Microsoft.

Like True Type fonts, this contains both the screen and printer font data in a single component. However, open type fonts support multiple platforms and expanded character sets. Additionally, open type format allows the storage of upto 65, characters. This additional space provides freedom to include add-ons such as small caps, old style figures, alternate characters and other extras that previously needed to be distributed as separate fonts.

However, not all open type fonts contain additional characters. Many fonts have been converted from either PostScript or TrueType formats without expanded character sets to take advantage of the cross-platform functionality benefits of Open Type. OpenType fonts that do contain expanded character sets are referred to informally as OpenType Pro fonts. Support for OpenType Pro fonts is increasing, but the format is yet to be fully supported by all applications.

Every time printing takes place, same character will appear with same shape e. Times New Roman, Arial etc. Dynamic font is a web browser technology used when visiting any website that uses fonts which are not installed on client's machine. The web browser would not be able to display the page properly, but will select one of fonts available on client machine.

In this the characters are redefined at each occurrence everytime they are displayed or printed. All hand written fonts such as handwritten alphabets, calligraphic letters, graffiti etc are dynamic fonts because of individual variations. This technology is helpful in displaying multilingual websites. Many tools have been developed to facilitate the typing of Indian language text.

These tools broadly support two types of text entries: But while typing, the Indian alphabets are written phonetically i. For e. The whole arrangement of mapping the keyboard keys to specific language characters is known as keymap. A keymap is internally stored as a table.

Multiple keymaps are used to store complete keymapping e. Entering Indian language text. When Nukta "-" is typed after character, the character shown to its left on the key, is obtained. Future Trends You can get more information on Indian script keymaps from http: At present very few open source endeavors which involve few people are there and are largely unstructured and undisciplined. But as this concept matures in future more OSS projects will come up and will adopt more structured methodologies to code, control and coordinate.

In future this concept will be adopted at a big level by private and government sector. This will force companies to embrace open source and will force the open source community to innovate in line with more complex need of government and business. ODF Open Document Format offers an open alternative to the formats used by all of the existing software.

Ogg Vorbis is open audio compression format. Post Script font consists of two parts which are both necessary for the font to be properly printed and displayed on screen. True type fonts contain both the screen and printer font data in a single component.

Open type fonts support multiple platforms and expanded character sets. On the basis of their configuration, fonts are categorized as static fonts and dynamic fonts. For entering text in Indian script keymap based or phonetic text based entry can be done. Give at least two examples of OSS. Justify that free software is not open source software. Write down its components, their areas of applications, their file extensions. Identify and name the various methods and properties associated with the various form controls Create simple applications in Java using NetBeans IDE.

Create GUI applications using the concepts of variables and control structures. The GUI builder automatically takes care of the correct spacing and alignment of the different components relative to each other.

The JFrame acts as a container for the elements like the JLabel, JButton, JTextArea and allows direct editing of their associated properties at the design time and run time. The related methods are used in the code to develop applications for a specific task. The concept of variables and control structures are used to simplify the code of the applications. This group of phrases has something amazing hidden in it.

Try and find out what is so unusual about this group of phrases? Is there any specific pattern in each line? Delia failed. Evil olive Pull up if I pull up. Step on no pets. Ten animals I slam in a net. Was it a bat I saw? Was it a car or a cat I saw? We found an interesting pattern in the puzzle and we will use this concept to develop an application in netbeans. Let us take a journey back in time and think as to what the world was like 15 years ago.

site was a large river in South America. Yahoo was a term from Gulliver's Travels. A googol was a very large number one followed by a hundred zeroes and to get our tickets booked we had to go to shops called 'travel agents'. In case we fell sick and went to a hospital, our records were maintained on paper. If the doctor wanted to refer to a particular patient's record, he had to instruct a assistant to hunt for information from the pile of files.

Nowadays hospitals use computers to keep the records of patients - medical history, details on what medication to give to a patient, the prescribed dosage and also personal details that can be accessed at the click of a button.

The entire information is entered into a computer using a front end that accepts the different patient details. This chapter will help us recapitulate all the concepts learnt in class XI.

Figure 3. Title Bar 2. Menu Bar with pull down menus 3. Toolbars 4. GUI builder: It is an area to place components on the form visually. We can switch over from one view to another by simply clicking on the source and design tabs directly above the Design Area.

Palette contains controls or components used to create GUI applications. Inspector Window: This window is used to display a hierarchy of all the components or controls placed on the current form. Properties Window: Using this window we can make changes in the properties of currently selected control on the form. Code Editor Window: Components also known as "widgets" are the basic interface elements the user interacts with: Components are placed on a container like the jFrame.

There are two types of controls: They act as a background for other controls. For example-Frame. When we delete a parent control, all its child controls get deleted. When we move a parent control all its child controls also move along with it. For example-Text Field, Label, Button etc. Components Parent or container controls: Child controls:. Parent or container controls Child controls Figure 3. Select New Project from the File menu. In the Categories pane, select the General node.

In the Projects pane, choose the Java Application type. Click the Next button. Enter the name of the project in the Project Name field and specify the project location.

Do not create a Main class here. Click the Finish button. Let us recap the relation between a Project, Form and Components. Each application is treated as a Project in NetBeans and each project can have one or multiple forms and this fact is clear from the Projects window as shown in Figure 3.

The visible components are all shown under the Frame Component and the non-visible components are part of Other components. We use the drag and drop feature of NetBeans to place components on the form to design an effective interface for our applications. The first step that we undertook while designing our applications was adding a new jFrame form. Some of the properties of the jFrame form are defaultCloseOperation and Title.

Title Sets the text to be displayed in the Title bar of the form window. Each of these objects belongs to its corresponding class predefined in Java. For example, a form is an object of JFrame class, all the textfields are objects of JTextField class, and so on. Each object has some properties, methods, and events associated with it using which you can control the object's appearance and behaviour.

Properties of an object are used to specify its appearance on the form. For example to set the background colour of a textfield you change its background property; to set its font you change its font property; and so on. Methods are used to perform some action on the object. For example to display something in a textfield you can use its setText method, to extract the contents of a textfield you can use its getText method. Methods can be divided into two categories- getters and setters.

Getters are the methods which extract some information from the object and return it to the program. Getters start with the word get. Examples of getters are: Setters are the methods which set some properties of the object so that the object's appearance changes. Setters start with the word set. Examples of setters are: Events are the actions which are performed on controls.

Examples of events are: When the user performs any action on a Property Description. After setting the properties of the jFrame we can start placing components like jButton on the jFrame form. A button is a component that the user presses or pushes to trigger a specific action.

When the user clicks on the button at runtime, the code associated with the click action gets executed. The various methods and properties associated with the jButton are summarized in Figure 3.

Background Sets the background color. Enabled Contains enabled state of component - true if enabled else false. Font Sets the font. Foreground Sets the foreground color. Label Sets the display text. Text Sets the display text getText Retrieves the text typed in jButton. It displays a single line of read-only text, an image or both text and image. The various methods and properties associated with the jTextField and jLabel are summarized in Figure 3. Border Sets the type of border that will surround the text field.

Default is true. Well can you recall the name of the component. Exactly the component is Text Area component. This component allows us to accept multiline input from the user or display multiple lines of information. This component automatically adds vertical or horizontal scroll bars as and when required during run time. The various methods and properties associated with the jTextArea are summarized in Figure 3.

Default is false rows Sets number of rows preferred for display. That's right the component is jPassword. We can suppress the display of input as this component allows us to input confidential information like passwords.

Each character entered can be replaced by an echo character. The properties of jPassword are summarized below: But radio buttons occupy a lot of space. Thus, in case of too many options we used Combo boxes as they help save space and are less cumbersome to design as compared to radio button. We used check box and list when we wanted to display multiple options like selecting favourite sports or ordering multiple food items in a restaurant. The list is a preferred option over check box in situations wherever multiple options are required to be selected from a large number of known set of options as they help save space and are less cumbersome to design as compared to check boxes.

The properties and methods of jRadioButton are summarized below: Selected Sets the button as selected, if set to true, default is false. When you click on it, it changes from checked to unchecked or vice versa automatically. The properties and methods of jCheckBox are summarized below: The properties and methods of jComboBox and jList are summarized below: It required an import statement at the top of the program. Well can you recollect the import statement? That's right it is: JOptionPane; OR import javax.

The difference is that the latter will import the entire library as denoted by the star whereas the first statement will just import the JOptionPane library. User can respond by pressing any of the suitable buttons. It prompts the user with a text box in which the user can enter the relevant input. Well, we used variables when we required containers to store the values for some input, intermediate result or the final result of an operation. The characteristics of a variable are: It has a name.

It is capable of storing values. It provides temporary storage. It is capable of changing its value during program execution. Variables help us to hold value for some input coming from the user or to hold intermediate result of some calculation or the final result of an operation. In other words, variables are like containers that can be used to store whatever values are needed for a specific computation. However, as different materials require different containers, and so we used different data types to hold different values.

When programming, we store the variables in our computer's memory, but the computer has to know what kind of data we want to store in them, since it is not going to occupy the same amount of memory to store a simple number or to store a single letter or a large number, and they are not going to be interpreted the same way so variables were used along with datatypes.

The data types supported by java are summarized as follows: Data type states the way the values of that type are stored, the operations that can be done on that type, and the range for that type.

These data types are used to store integer values only i. The storage size and range is listed below: These data types are used to store characters. Character data types can store any type of values - numbers, characters and special characters. When we want to store a single character, we use char data type and when we want to store a group of characters we use string data type.

For example to store grades A, B, C, D, E of a student we will use char type but to store name of a student, we will use string type. The char data type value is always enclosed inside ' ' single quotes , whereas a string data type value is enclosed in " " double quotes. Operators are symbols that manipulate, combine or compare variables. Character Data Types: Operators With the introduction of variables and constants there arose a need to perform certain operations on them.

We performed operations on variables and constants using operators. The operators available in java are summarized below: We assign the value given on the right hand side to the variable specified on the left hand side.

The value on the right hand side can be a number or an arithmetic expression. These symbols are similar to mathematical symbols. Arithmetic Operators: A mathematical expression created using a relational operator forms a relational expression or a condition. The following table lists the various relational operators and their usage: Logical operators and relational operators are used together to form a complex condition.

Logical operators are: Operator Meaning Usage Logical Operator: The unary operators perform different kind of operations on a single operand. In both conditions 1 is added to the value of the variable and the result is stored back to the variable. However, in a prefix expression, value is incremented first then this new value is restored back to the variable.

In postfix expression the current value is assigned to a variable then it is incremented by 1 and restored back to the original variable. Let us now try and recollect the conversion methods that we have used in java. When a Java program receives input data from a user, it must often convert it from one form e. To convert a string value to a number For example, to convert the String value in a text field jTextField1 to an int, long, float or double , we can use parse methods.

Assume the following declarations: Assume the following code: To convert a number to string, we also used toString method. If either operand of a concatenation is a string, the other operand is converted to string.

We learnt two types of control structures in class XI namely, Selection statements and Iteration statements. Control structures allow us to control the flow of our program's execution. If left unchecked by control-flow statements, a program's logic will flow through statements from top to bottom. We can have some control on the flow of a program by using operators to regulate precedence of operations, but control structures provide the power to change statement order and govern the flow of control in a program.

A selection statement selects among a set of statements depending on the value of a controlling expression. The selection statements are the if statement and the switch statement, which are discussed below: The if statement allows selection decision making depending upon the outcome of a condition. If the condition evaluates to true then the statement immediately following if will be executed and otherwise if the condition evaluates to false then the statements following the else clause will be executed.

The selection statements are also called conditional statements or decision statements. The syntax of if statement is as shown below: The conditional expression is always enclosed in parenthesis. The conditional expression may be a simple expression or a compound expression. Each statement block may have a single or multiple statements to be executed. The else clause is optional and needs to be included only when some action is to be taken if the test condition evaluates to false.

These control structures are used to test for multiple conditions as against the simple if statement which can be used to test a single condition.

The syntax of nested if else is as follows: Nested if. Add a label set its Text as Enter Number 3.

Add a jTextField and set its initial Text as "" 4. Add three radio buttons on the form - Set the text of each of them as "Multiple of 3", "Multiple of 5" and "Multiple of 7". Group the radio buttons so that only one can be selected. In this application we ask the user to enter a number and then the user will select one of the radio buttons and depending upon the button selected the multiple check for that number will be performed.

Let us now write the code for the above mentioned application. Code to check for multiple of 3 is given. Try and write the code to perform a similar check for multiple of 5 and multiple of 7. This value by default is treated as a string and not as a number so it needs to be converted to a double type and this is achieved using the parseDouble method.

The value is then stored in the variable Number. If the remainder is zero then the number is divisible by 3 else it is not. This selection statement allows us to test the value of an expression with a series of character or integer values.

On finding a matching value the control jumps to the statement pertaining to that value and the statement is executed, till the break statement is encountered or the end of switch is reached. The expression must either evaluate to an integer value or a character value.

It cannot be a string or a real number. The syntax of the switch statement is as follows:. If we are handling specific coded values eg, the number of the button that was clicked in a JOptionPane , or processing characters whose codes are treated like numbers , then switch is useful.

The limitations of switch are as follows: It doesn't allow ranges, eg case It requires either integers or characters and doesn't allow useful types like String. ParseInt jTextField. Let us look at the example given above, when a selection is to be made based on a single value, the switch statement is generally easier to read.

It has a shorter syntax and is more appropriate in this case. Let us now design an application in which we will calculate the selling price depending upon the profit percent selected by the user. Design the application as shown in figure 3.

Set the relevant properties of the components. Let us now write the code. The value is then stored in the variable CP. This value is saved in a variable profit.

In the above application the profit margin is obtained from the Index value of the selected item of the combo box but what happens if the values in the combobox are as shown in the figure 3. Only the code using switch case is given below but it is recommended that you think and try writing the code on your own. Iteration statements are also called looping statements. The loop has four different elements that have different purposes.

These elements are: Before entering in a loop, its variables must be initialized. The test expression decides whether the loop body will be executed or not.

If the test condition is true, the loop body gets executed otherwise the loop is terminated. The statements, which are executed repeatedly while the test expression evaluates to true form the body of the loop. The syntax of the for loop is: Using this fact an infinite loop can be created as follows: While Loop - The while loop is an entry-controlled loop. It means that the loop condition is tested before executing the loop body. If the loop condition is initially false, for the first iteration, then loop may not execute even once.

The main characteristic of the while loop is that it can be used in both cases i. The syntax of the while loop is as follows: While loop is an exit-controlled loop.

In the do.. This ensures that the do.. After the first execution of the statement, it evaluates the test expression. If the expression evaluates to true, then it executes the statements of the loop body again.

Like if and while statements, the condition being checked must be included between parenthesis. The while statement must end with a semicolon.

The syntax of the loop is as follows: Therefore, the statements within the do block are always executed at least once. Do- while is an exit controlled loop and while is an entry controlled loop. In do while counter is checked at the end of loop body,therefore loop body is executed at least once. Let us now design an application in which we will generate the series and its sum. This value by default is treated as a string and not as a number so it needs to be converted to an integer type and this is achieved using the parseInt method.

The value is then stored in the variable Start. This value is saved in a variable Step. The value is then stored in the variable Terms. Now we have the value from where the user wants to start the series, the terms in the series and the step between numbers of the series.

Index -1 indicates that no item is selected. The pattern that we found in the phrases was that each line had a palindrome hidden in it.

This value by default is treated as a string and not as a number so it needs to be converted to long type and this is achieved using the parsetLog method.

In this loop we divide temp by 10 and obtain the remainder. The remainder is then added to the value in the variable RevNumber multiplied by The value of variable temp is divided by 10 every time the loop is executed. The loop is executed as long as temp is greater than 0. Now in the next few chapters we will enhance our knowledge of NetBeans and delve further into programming concepts. NetBeans provides various components used to create a GUI front-end interface.

GUI components' appearance and behaviour is controlled by their properties and methods. We should use meaningful names for controls on the form and variables in the code.

It makes programming convenient. Some useful Data Types supported in Java are: String is an Object reference type supported in Java.

A variable must be declared before it can be used. Different types of operators are available in Java. Operators are used to perform various operations on data. Control Statements available in java are: What will be the output of the program given below.

Which number is printed twice? Consider the following code snippet: What will be the value of total after the loop finishes execution. What's wrong with the while statement? If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block? Given the following information: Explain the following terms: Differentiate between: What is the significance of the following properties in TextArea?

LineWrap WrapStyleWord 4. What are list type controls used for? How would you determine whether a combo box is editable or not? List different selection modes of a list. What is a button group? Which control is generally used with a buttongroup. Write and explain two methods each of check box and radio button. Design a GUI application in which the user enters a number in the text field and on clicking the button the sum of the digits of the number should be displayed in a label.

Design a GUI application to accept a String from the user in a text field and print using option pane whether it is a palindrome or not. Hint ABBA is a palindrome. Design a GUI application to accept the cost price and selling price form the user in two text fields then calculate the profit or loss incurred. Design a GUI application to accept a character in a text field and print in a label if that character is a vowel: The application should be case sensitive.

Design a GUI application that repeatedly accepts numbers in a option pane and once the typed number is 0 the maximum and minimum of all numbers typed are displayed. Design a GUI application in java to convert temperature from Celsius to Fahrenheit or vice versa using radio buttons and two text fields 7.

Design a GUI application in java to convert kilograms into grams, litres into milliliters, rupees into paisa using combobox and text fields. A book publishing house decided to go in for computerization. The database will be maintained at the back end but you have to design the front end for the company.

You have to accept book code, Title, Author and Quantity sold from the user.Evaluation of Practical Examination 1. The various methods and properties associated with the jTextField and jLabel are summarized in Figure 3. What property would you set to assign access key to a button?

Not used for communication. Different types of switches available in the market, their prices, and number of ports. Based on their frequencies, electromagnetic waves are categorized into various categories. What are the three constructs that govern statement flow? UTP cable c. An IP Internet Protocol address is a unique 4 digit hexadecimal number assigned to each node on a network. While Loop - The while loop is an entry-controlled loop.