Recent Posts

Friday, November 16, 2018

CBSE Class 11 Informatics Practices Chapter 6 Java IDE Programming – I , II & III

Class Notes of Chapter 6: Java IDE Programming – I , II & III
Class 11th Informatics Practices

Introduction to Programming Languages

      Topics:
  • Introduction
  • Commonly Available Swing Controls in Java
  • Important Questions

Introduction
In Java, the GUI programming is done through Swing API ( Application Programming Interface).

Swing is a set of classes that provides more powerful and flexible components that are possible with AWT (Abstract Windows Toolkit). It supplies buttons, checkboxes, labels, tabbed panes, scroll pans, trees, tables, dialog boxes etc.

The swing controls/components are categorized as:
  • Components: Self-contained graphic entity ( eg. JLabel, JBotten, JTextField etc)
  • Containers: Component that can hold other components (eg. JPanel, JFrame, JDialog, JWindow) 

Commonly Available Swing Controls in Java
  • jFrame: A-Frame is a container control, in which all the controls can be lace.
  • jLabel: JLable allows placing un-editable text on the Frame/Panel
  • jTextField: JTextFeild allows placing editable text on the Frame/Pane. The user can enter text in a text field during runtime.
  • jbutton: is used to initiate an action when it is clicked.
  • jList: is a group of values or items from which one or more selections can be made.
  • jComboBox: jComboBox is similar to jList but also allow to enter editable text during run time. It is a combination of jTextFiled and jList.
  • jRadioButton: Allow us to choose a single item from a group of jRadioButton options.
  • jCheckBox: Allow us to choose one or more items from a group of jCheckBox options.
  • jPasswordField: Allow us to enter a text during the runtime but shows an encrypted text instead of the original text
  • jTextArea: JTextArea is a multi-line text component to enter or edit text.
  • Focus: The control under execution is said to have the focus. The control having the focus obtains input from the user.
  • getText(): getText() method is used to obtain the text from a jTextFeild during the runtime.
  • setText(): setText() method is used to set or change the text of a jTextFeild during runtime.

Important Questions

Q. Which window is used to designed the form.
A. Design window

Q.Which window contains the Swing Controls components.
A. Palette window

Q.What is the most suitable component to accept multiline text.
A. Text Area

Q.What will be the output of the following command? Learning.concat("Java")
A. Error

Q.What will be the output of the following command? "Learning".concat("Java")
A. LearningJava

Q.Name the different list type controls offered by Java Swing.
A.
(i) jListBox
(ii) jComboBox

Q. Name any two commonly used method of ListBox.
A.getSelectedIndex() and getSelectedValue()

Q.Write code to add an element (“New Course”) to a list (SubList) at the beginning of the list.
A.SubList.add(0,”New Course”);
Q.By default a combo box does not offer editing feature.How would you make a combo box editable.
A. By setting its editable property to false.

Q. Write Name the component classes of Swing API for the following components- a) frame (b) button
A. (a) JFrame (b) JButton

Q.What is the name of event listener interface for action events ?
Ans: ActionPerformed

Q.What does getpassword() on a password field return ?
Ans: A character array.

Q.What is event driven programming?
Ans:This programming style responds to the user events and is driven by the occurrence of user events.

Q.What are containers? Give examples.
Ans: Containers are those controls inside them e.g., frame (JFrame), Panel (JPanel), label (JLabel) etc. are containers.

Q.Which method of list is used to determine the value of selected item, if only one itm is selected?
Ans: getSelectedValue()

Q.Which type of storage is provided by variables?
Ans: Temporary

Q.What will be the output of the following code segment:
String firstName = "Manas ";
String lastName = "Pranav";
String fullName = firstName + lastName;
jTextField1.setText("Full Name: ");
jTextField2.setText (fullName);

Ans: Full Name: ManasPranav

Q.Which expression is used to print the value of a variable "x" of type int.
Ans: jTextField1.setText("x = " + x);

Q.The statement i++; is equivalent to
Ans: i= i+1

Q.Name the primitives datatypes in java.
Ans: Numeric type , Fractional type, Character type and Boolean type.

Q.Which events gets fired when a user click a JButton and JRadioButton.
Ans: ActionPerformed

Q.Which of the following is a selection construct?
A. do while Loop b. for Loop c. while Loop d. None of these
Ans: d . None of these

Q.What will be used if there are two or more possible options?
Ans: We can use if…..else conditional statement or switch……case statement.

Q.Name the loop that never ends.
Ans: Infinite loop. For example:

for( k=1;k<=10;k++)
{
System.out.println(“It is infinite loop”); k=k- 1;
}

Q.Which braces is used to enclose statements in a block statement.
Ans: { } Curly braces

Q.Which of the following is an exit controlled loop?

A. for loop b. do while Loop c. while loop d. none of these
Ans: do…. while loop

Q.Which process is used to translate a task into a series of commands that a computer will use to perform that task.
Ans: Project design

Q. Which of the following component is the best suited to accept the country of the user?

A. List B Combo box C Radio button D Check box
Ans: List and combo box

Q. Which construct will be used to find the sum of the first 10 natural numbers?
Ans: for loop

Q. Which of the following is not a good programming guideline?
Ans: Using text fields to accept input of marital status.

No comments:

Post a Comment