127 Std 12 Viva Question Answers
-
Upload
arjun-prasad -
Category
Documents
-
view
220 -
download
0
Transcript of 127 Std 12 Viva Question Answers
-
8/13/2019 127 Std 12 Viva Question Answers
1/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
1
1. Differentiate between getText() and setText().getText()-Used to retrieve text.
setText()-Used to set the text.
2. Differentiate between TextField and TextArea.Text Area-Accepts Multiple Lines of Data
Text Field-Accepts Single Line of Data
3. What is meant by a ternary operator?Consists of 3 Operands - ? :
4. What is meant by Integer.parseInt?Integer.parseInt is used to convert string value to integer value.
5. What property has to be added to get color on a label?Opaque property has to be added to get color on a label.
6. What is the difference between isSelected() and setSelected()?isSelectedreturns true if the component is selected.
setSelectedsets the component as selected, if set to true, default is false
7. What is the difference between getSelectedIndex() and getSelectedItem()?getSelectedIndexretrieves the index of the selected item
getSelectedItemretrieves the selected item
8. How the items in a jList can be added?The items can be added to a jList by the way of model property
9. What is the purpose of using break statement?Break statement terminates the current loop.
10.What is a button group?Button group is an invisible component by which the user can select one
option from multiple choices and all the options comes under one group
eg. Radiobutton, Checkbox etc.
-
8/13/2019 127 Std 12 Viva Question Answers
2/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
2
11.What is the difference between jRadioButton and jCheckBox?jRadioButton is commonly used to select one option out of many choices
jCheckBox can be used to select all the options at a time
12.Explain event handler?It is used to handle different types of events. Example: action performed,
focus lost, key pressed etc.
13.Explain the eventstate changed?The event state changed for the specified component is subjected to change
during the run time. Like being Selected or Deselected
14.What are the advantages of applying menus in java?It occupies less space, easily understandable
15.What does the trim method will do?The trim function is used to remove leading and trailing spaces for the given
text.
16.What for length () method is used?It returns the number of characters for the given string.
17.What is the difference between Integer.parseInt and Integer.toString?Integer.parseIntis used to convert string value to integer value.
Integer.toStringis used to convert integer value to string.
18.What is the difference between string and string buffer?String-They are mutable .Once created cannot be changed, if any change
occurs the original remains unchanged and new string will be created with
the changed name.String Buffer- These are immutable. These can be changed or modified
according to the user.
19.What property has to be implemented in the list for accessing the listcontrols?
-
8/13/2019 127 Std 12 Viva Question Answers
3/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
3
The list must be given a custom code(new DefaultListModel) in their model
properties.
20.What is the difference between getSelectedValue() and getSelectedIndex()?getSelectedValue()-Returns the value when single item is selected, if
multiple items are selected then returns the first selected value.
getSelectedIndex()-Returns the index of the selected item.
21.What is the purpose of using Default List Model ?It is the default implementation of list model which offers methods for
manipulating list elements.
22.State the difference between getModel and setModel.getModel()-Used to retrieve the model of the given component.
setModel()-Used to set the model of the component.
23.Explain about JOptionPane. What are the different methods that can be usedalong with it?
JoptionPane is an Abstract Class in java for which there is no requirement of
objects. Different Methods with JoptionPane are-showMessageDialog,
showConfirmDialog, showInputDialog
24.Explain about jPanel.Jpanel is a Middle Level Container. It can hold various components within
it. It is a parent component of Swing Containers.
25.Explain about Java Math class.It consists of various in built methods used for performing mathematical
operations like rounding of the decimal places, adding the amounts,
removing the decimal places etc.26.Explain the methods that are used along with math objects.
round(double a)-used to round off the given value to the nearest number
truncate(double a,int b)-removes the decimal places
27.Explain about String Buffer class.
-
8/13/2019 127 Std 12 Viva Question Answers
4/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
4
String buffer classes are mutable. These can be changed or modified
according to the user.
28.Explain the methods that are used along with string buffer.reverse()-used to reverse the given string
length()-retrieves the number of characters of the given String
insert()-used to insert a new string with the previous String
29.What is meant by a class?Class is used to encapsulate data and methods together in a single unit.
30.What has to be carried out in the jTable model properties?The table settings (column details) have to be given. The number of rows
has to be set to Zero.
31.What does the addRow method does?addRow method is used to add a new row to the table
32.Explain about getSelectedRow() and getRowCount()?getSelectedRow()-Returns the selected row from the table
getRowCount()-Returns the total number of rows in the table
33.What does removeRow() method does?Used to remove the selected row from the table
34.What does getValueAt() method does?Used to return the cell values for the rows and columns
35.Explain about call by value and call by reference?Call by value-Uses variables to interchange the values
Call by Reference-Uses Jframe to interchange the values
36.In the given statement, public class callby extends javax.swing.JFrame,which is the super class and which is the sub class?
Super class-javax.swing.Jframe
Sub Class-name given for the Jframe Form (callby) acts as the sub class
-
8/13/2019 127 Std 12 Viva Question Answers
5/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
5
37.What is the difference between combo box and a list box?Combo Box- Allows only single selection
List Box- Allows multiple selections
38.What does getSelectedIndex()==0 denotes?This denotes that the first index is selected
39.What is the difference between do while loop, while loop and for loop?Do while loop-exit controlled loop
Test expression is tested at the end of the loop.
While loop-entry controlled loop
Test Expression is tested at the beginning of the loop
For loop- Initialization expression, Text Expression, Increment/Decrement
Expression, Body of the loop
40.State any two methods that can be associated with each of jLabel, jButton,jTextField, jCombo Box, jRadio Button, jTextArea, jCheckBox, jList,
JOptionPane.
jLabel-getText(),SetText()
jButton-setEnabled(), setVisible()
jTextField-isEnabled(), setText()jComboBox-getSelectedItem, getSelectedIndex
jRadioButton-isSelected(), setSelected()
jTextArea-append, setText()
jCheckBox-isSelected(), setSelected()
jList-getSelectedValue(),isSelectedIndex()
JoptionPane-showMessageDialog, ShowConfirmDialog
41.What is inheritance? What are the various forms that are used in it?Method of creating new class called Sub class from the main class(SuperClass).Various Forms-Single Inheritance, Multiple Inheritance, MultiLevel
Inheritance, Hierarchical and Hybrid.
42.Define polymorphism. Give examples.
-
8/13/2019 127 Std 12 Viva Question Answers
6/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
6
It is the ability of a method that can be executed in many forms.
Example-operator overloading and method overloading
43.What is the importance of abstract class in java?The class for which it is not essential to declare objects is called abstract
class. Example-JoptionPane, Jframe.Since they do not require objects they
are used as base Class.
44.What is a front end?The application provides some form using which the user enter data is called
the front end.
45.What is a back end?The application which usually stores a lot of data in the form of database is
called back end.
46.What is JDBC?Java Database Connectivity is used to establish connectivity between java
and the databases.
47.What are the basic class libraries that are required in the application for dataconnectivity? How to add these libraries into our application?The basic class libraries are Driver manager class, Connection class,
Statement class. These can be added by importing it into our application.
48.Why forName() method is used?forname()-used to load the Driver Class
49.What is data validation?It is the process of ensure that a program operates on clean, correct anduseful data.
50.What is the purpose of using isEmpty() method?isEmply()-used to check if any of the component is empty
-
8/13/2019 127 Std 12 Viva Question Answers
7/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
7
51.What for class.forName method is instantiated?Instantiated to connect database Server with JDBC
52.Explain the given statement - Connection con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/details","root","
mysql123" .
The getConnection() is used to establish the connection to the database.
53.Explain the following command : Statement stmt=(Statement)con.createStatement();
It is used to create a statement stmt from the connection object by using
createStatement() method. It is used to send and execute SQL statements.
54.Explain the given command : String query="INSERT INTO dept VALUES(' "+name+" ',' "+age+" ',' "+gender+" ',' "+dept+" ',' "+location+" ');";
A variable query with string type is created to initialize SQL statement and
this statement is used to add values into the mysql table.
55.Explain the given statement : stmt.executeUpdate(query);Executes the SQL statement stored in query by using executeUpdate()
method.
56.Identify the object name, class name and method name used in the givenstatement : ResultSet rs= stmt.executeQuery(query);
Class-ResultSetObject-rs
Method-executeQuery()
57.What does the rs.next() method does?Used to move to the next record in the database
58.Explain the methods getString() and getInt().getString()-used to retrieve the String values from the databasegetInt()-used to retrieve the integer values from the database.
59.Explain the usage of the following methods : rs.close(), stmt.close(),con.close().
-
8/13/2019 127 Std 12 Viva Question Answers
8/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
8
These methods are used to close all the operations of result set, statement,connection.
60.What are the DDL commands?These are commands which are used to create, destroy or restructure
databases and tables. DDL commands areCREATE, DROP, ALTER
61.What are the DML commands?These are commands which are used to manipulate data within tables. DML
commands areINSERT, UPDATE, DELETE.
62.Name the clauses that can be used along with SELECT command.DISTINCT, WHERE, BETWEEN, IN, LIKE, IS NULL/ NOT NULL,ORDER BY, GROUP BY, HAVING, UNION
63.Explain the numeric functions with example.Numeric functions perform operations on numeric values and return numeric
values. Numeric functions areROUND, POWER, TRUNCATE
64.What for concat() function is used?It is used to join or combine two or more strings.
65.What is the difference between instr() and substring() function?INSTRreturns the position of the first occurrence of the given string.
SUBSTRING or MIDreturns the specified number of characters from themiddle.
66.Define aggregate functions. Give examples.They work on multiple values to return a single value.
Example-sum(),avg(),min(),max()
67.What is the difference between where clause and having?Where clause is used to put a condition on a individual row in a selectstatement. Having is used to put a condition on individual group formed by
group by clause in a select statement
68.What is the purpose of using group by?
-
8/13/2019 127 Std 12 Viva Question Answers
9/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
9
Group by clause is used in select statement in conjunction with aggregatefunctions to group the results based on distinct values
69.Define primary key and candidate key.Primary key-used to uniquely identify each row
Candidate key-a column or a group of columns which can be used as theprimary key
70.What is the purpose of using UNION in SELECT statement?Union is used to combine two select statements
71.What is the difference between cross join and equi join?Cross join-obtained by pairing each row of one table with each row of other.Equi join-obtained by putting equality condition on cartesian product of two
tables.
72.What is the difference between DROP and DELETE?Drop-used to drop the entire tableDelete-used to delete individual record from the table
73.Define a transaction.The unit of work that has to be done in a logical order and successfully as agroup or not done at all.
74.What is the difference between commit and rollback?Commit is used to save all the changes made to the database. It is issued at a
time when the transaction is complete and all the changes have beensuccessful and needed to be saved to database.
Ex-Commit work;
Roll back cancels the entire transaction. It rolls the transaction to thebeginning. It aborts the changes made to the transaction.
Ex-Rollback work;
75.JFrame contains several pane. To what pane are the components added?76.Which property would you set for setting the password as @ ?
-
8/13/2019 127 Std 12 Viva Question Answers
10/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
10
77.What is the difference between action performed and key typed?78.Difference between OL and UL tag.79.What is a component?80.What is inheritance? Give an example by the way of source code.81.State any 2 methods in math class which does not take parameters.82.State any 2 methods in String class which does not take parameters.83.String a =jTF1.getText(). Explain the entire statement.84.JComboBox1.getSelectedItem(). What will be the return type for the
method?
85.What is concrete class? Give one example.86.If a column in a table is having a relation with another table, then the column
is called as what?
87.What will be the values that can be applied along with aggregate functions?88.State the languages that are supported by procedural programming.89.Which package is added to the JFrame automatically?90.What is a foreign key?91.Give an example for save point.92.Write a query using union all.93.What is data encapsulation?
-
8/13/2019 127 Std 12 Viva Question Answers
11/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
11
94.Difference between int and Integer.95.How does x.equals() is different from x= =?96.Explain about commit and rollback.97.When creating a table if the primary key constraint is not added, can it be
added later? If so, specify the query?
98.Mention any two native classes that are supported by java.99.Which keyword in java is used to many any variable as constant?100. What is a dialog? State any 2 methods that can be used along with
JOptionPane.
101. Define GUI.102. What is a component?103. Define a method.104. What is an event?105. What is a Boolean datatype?106. Difference between getSelectedIndex and getSelectedItem.107. Difference between isSelected and setSelected.108. Methods of JOption109. Write the syntax and example for all the control statements.110. Difference between if and switch111. Difference between while and do while112. Difference between int and Integer113. Difference between int x and String x114. Define object oriented programming115. State the languages supported by object oriented programming116. Define procedural programming117. State the languages supported by procedural programming
-
8/13/2019 127 Std 12 Viva Question Answers
12/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
12
118. State the languages supported by object oriented as well as proceduralprogramming.
119. Difference between procedural programming and object orientedprogramming.
120. Define class.121. Define object.122. What is meant by data encapsulation?123. What is meant by data abstraction?124. Give example for data member.125. Define polymorphism.126. Explain the types of polymorphism with a suitable example.127. How method can be overloaded? Give example.128. What is an abstract class? Give example.129. What is a concrete class? Give example.130. What is an inheritance? Give one example by the way of source code.131. What are the methods that are used in math class?132. What are the methods that are used in string class?133. State any 2 methods in math class that do not take parameters.134. State any 2 methods in string class that do not take parameters.135. It is not necessary to import any package for the math class. Why?136. State any 2 conversion methods137. What are the different levels of containers in java?138. Difference between action performed and caretupdate.139. Mention any 4 native classes of java.140. Which package is added to the jFrame by default?141. Which keyword is used to make a variable constant?142. For(int x=1; ; x++) is there any error with the given statement or what
will be the output?
143. Whether, if(a= = ) is equal to if(a= = null) ?144. I am in the source window, now I want to add a component, but Icouldnt get the palette window. Why?145. jFrame contains several pane. To which pane are the components
added?
146. Which property would you set for setting the password character as%?
-
8/13/2019 127 Std 12 Viva Question Answers
13/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
13
147. Difference between OL and UL tag?148. jList1.isSelected( ), what will be the return type for method?149. Is there any difference between a jRadioButton and a jCheckBox
initially?
150. Which keyword is used to inherit data members and methods of thebase class and allows the derived class to use it?
151. Which package is added to the jFrame automatically?152. Difference between seticon and icon property.153. Difference between system.exit and dispose.154. Any three non printable characters other than \n.155. What is meant by type conversion?156. What are the different types of access specifiers ? Explain.157. What are the basic libraries that are required to work with database
connectivity?
158. What is jdbc api?159. Can you insert or remove rows from an existing jTable?160. Which property is used to give color to a label?161. Which property is used to change the choices displayed in a list?162. Which property is used to change the selection163. Which component of a swing window lets you to create a general
dialog?
164. What is meant by data validation? State any one method related todata validation.
165. What is meant by open source software?166. How open source software different from proprietary software?167. What is UNICODE?168. Difference between ASCII and ISCII.169. What is meant by degree and cardinality?170. Explain DML and DDL.171. What is a relation?172. Difference between tuple and attribute.173. What is meant by referential integrity? Give one example.174. Explain numeric function and its types in detail.175. Explain string function and its types in detail.176. Explain date and time function and its types in detail.
-
8/13/2019 127 Std 12 Viva Question Answers
14/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
14
177. What is meant by aggregate function?178. What are the datatypes that can be applied along with aggregate
functions?
179. Explain equi join and cross join.180. How null values are treated along with aggregate functions?181. Difference between having and where.182. Difference between orderby and groupby.183. Give one example for union and union all.184. Explain about the various constraints in mysql.185. Define a transaction.186. What is meant by rollback and commit?187. If a column in a table is having a relation with another table, then how
the column can be referred?
188. Define savepoint. Give one example.189. What are primitive datatypes?190. What are reference datatypes?191. What is the difference between System.exit(0) , dispose( ) ?192. What is meant by fall through?193. What is the difference between break and continue?194. Name two classes to be imported for JDBC.195. Write the range of short and int datatypes.196. Write the statement i) to convert a String S to an integer N ii) to
convert a double B
to an integer A.
197. What does the catch block do?198. Define constraints.199. State two important properties of JCombobox.200.Explain the syntax of the import statement.201.Explain src and align attribute of the image tag.202.Differentiate between html and xml.203.Which component of swing window let you create a general purpose
dialog?
204.How do you prevent a subclass from having access to a member of superclass?
205.What is void? Give example.
-
8/13/2019 127 Std 12 Viva Question Answers
15/15
INFORMATICS PRACTICESVIVA QUESTIONSSTD 12
15
206.What is a constructor? What are its types?207.What is return? Give example.208.Why xml called as meta language?209.What is the difference between and tags?210.What happens when autocommit is set on?