CBSE IT Class 11 and 12 Java NetBeans Notes Pdf Download

CBSE IT (Information Technology) Class 11 and 12 Java NetBeans Notes Pdf Download

CBSE IT (Information Technology) Class 11 and 12 Java NetBeans Notes Pdf Download for session 2021-2022.

Java IDE Programming – I , II & III
In Java, the GUI programmin is done through Swing API ( Application Programming
Interface).


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


The swing controls/components are categorized as:


o Components : Self contained graphic entity ( eg. JLabel, JBotten, JTextField etc)


o Containers: Component that can hold other components (eg. JPanel, JFrame,
JDialog, JWindow)
COMMONLY AVAILABLE SWING CONTROLS IN JAVA


o jFrame: A Frame is a container control, in which all the controls can be lace.


o jLabel: JLable allows placing un-editable text on the Frame/Panel


o jTextField: JTextFeild allows placing editable text on the Frame/Pane. User can enter
text in a text field during runtime.


o jbutton: is used to initiate an action when it is clicked.


o jList: is a group of values or items from which one or more selections can be made.


o jComboBox: jComboBox is similar to jList but also allow to enter editable text
during run time. It is a combination of jTextFiled and jList.


o jRadioButton: Allow us to choose a single item from a group of jRadioButton
options.


o jCheckBox: Allow us to choose one or more items from a group of jCheckBox
options.


o jPasswordField: Allow us to enter a text during the run time but shows an encrypted
text instead of the original text.


o jTextArea: JTextArea is a multi-line text component to enter or edit text.


o Focus: The control under execution is said to have the focus. The control having
the focus obtains input form the user.


o getText(): getText() method is used to obtain the text from a jTextFeild during the run
time.

o setText(): setText() method is used to set or change the text of a jTextFeild during
run time.
Swing Controls Methods and Properties:
These are the Swing Controls available with NetBeans IDe and their concern methods.

CBSE IT (Information Technology) Class 11 and 12 Java NetBeans Notes Pdf Download


Some Important Questions with Answers
1. Which window is used to designed the form.
Ans: Design window


2.Which window contains the Swing Controls components.
Ans: Palette window


3.What is the most suitable component to accept multiline text.
Ans: Text Area


4.What will be the output of the following command? Learning.concat(“Java”)
Ans: Error


5.What will be the output of the following command? “Learning”.concat(“Java”)
Ans: LearningJava


6.Name the different list type controls offered by Java Swing.
Ans:
(i) jListBox
(ii) jComboBox


7. Name any two commonly used method of ListBox.
Ans: getSelectedIndex() and getSelectedValue()


8.Write code to add an element (“New Course”) to a list (SubList) at the beginning of
the list.
Ans: SubList.add(0,”New Course”);


9.Describe the three common controls. Also give some of their properties.


10.By default a combo box does not offer editing feature.How would you make a
combo box editable.
Ans: By setting its editable property to false.


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


12.What is the name of event listener interface for action events ?

Ans: ActionPerformed


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


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


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


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


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


18.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


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


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


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


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


23.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


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

25.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;
}


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


27.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


28.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

  1. 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
  2. Which construct will be used to find the sum of the first 10 natural numbers?
    Ans: for loop
  3. Which of the following is not a good programming guideline?
    Ans: Using text fields to accept input of marital status.

  4. SHORT ANSWERS TYPE QUESTIONS

  5. 1.Explain the following terms:
    a) IDE b) Form
    Ans: IDE : IDE is an acronym for Integrated Development Environment which is a
    work environment that integrates all tools necessary for Application Development and
    makes them available as part of one environment.
    b) Forms: Forms are used to accept data (input) and submit data to an external agent
    for processing.
    2.Explain the usage of the following methods :
    a) setText()
    b) toString() concat()

Download PDF

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version