This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 4501. |
What output will the following code fragment produceint val, Res, n=1000;Res=n+val>l750 ? 400 :200;System.out.println(res);(i) If the input is 2000.(ii) If the input is 500. |
|
Answer» As there is no statement of input is given in the question. Hence, it should be a tricky question. As by default when we declare an integer in Java, it stores the value 0(zero). Hence, the value of val=0. (i) Output: 200 (ii) Output: 200 |
|
| 4502. |
Hari wants to add a column email of varchar type with size 20 in an existing table emp. Help him to write the command. |
|
Answer» ALTER TABLE emp ADD email VARCHAR(20); |
|
| 4503. |
The following code has error(s). Rewrite the correct code underlining all the corrections made :int j ;int i = 15;int flag = 1; while (j = 2; j < i; j ++) { if(i % j = 0) { flag = = 0; break; } } |
|
Answer» Correct Code : int j ; int i = 15; int flag = 1; while(j =2;j<1;j++) { if(i%j==0) { flag =0; break; } } |
|
| 4504. |
What is Program Maintenance? |
|
Answer» Program maintenance can be defined as the modification of the program after delivery to improve its performance and to make it more reliable to handle the updated needs and emerging threats. |
|
| 4505. |
(i) Write the value of C after executing the following code:int P;int R = 8;int oddNum;int C = 0;for(P = 1; P < R; P = P+3){ oddNum = P %2; if(oddNum = = 1) { C = C + 1; }}(ii) What the value that will be stored in the variable t after the execution of the following code. How many times will the loop execute?int sum = 0;int score = 0;double t; do { score = score + 1; sum = sum + score; } while (score < =3); t = sum/3; |
|
Answer» (i) C = 2 (ii) t = 3.33333333333 |
|
| 4506. |
What is the difference between TextField and Text Area? |
|
Answer» Text field allows the user to enter single line of text only, whereas text area component allows accepting multiple line input from the user. |
|
| 4507. |
(a) Write the values of r and s after the execution of the following code :int p = 11;int q = 21;int r;int s;r = ++q;s = p++;r++;(b) What will be displayed in jTextField1 and jTextField2 after the following code is executed:int ndigits = 0;int N = 35;while (N > 12) { ndigits = ndigits + 1;N = N -10;}jTextField1.setText(" "+ ndigits) ;jTextField2.setText (" "+N) ; |
|
Answer» (a) r = 23 s = 12 (b) jTextField1 will contain : 3 jTextField2 will contain : 5 |
|
| 4508. |
What will be displayed in jTextField1 after the following code is executed? Also write how many times will the loop execute.a = 5;b = 2;while (b ! = 0) { r = a % b; a = b; b = r; }jTextField1.setText (" " +a); |
|
Answer» Display in jTextField1; 1 This loop will run 2 times. |
|
| 4509. |
What is the difference between getSelectedIndex() and getSelectedItem( ) methods ? |
|
Answer» getSelectedIndex() returns the index number of item selected in combo box. Whereas, getSelectedItem() returns the selected item of the combo box. The return type of this method is object. |
|
| 4510. |
Write the purpose of HTML. Distinguish between <P> tag and <BR> tag. |
|
Answer» HTML is used to define the layout and attributes of a WWW (world wide web) document as well as to create link between web pages. <P> tag is used to separate our text by paragraphs, while <BR> tag is used to insert a line break. |
|
| 4511. |
Which property is to be used during design time to add a list of countries in the list box? |
|
Answer» Model property |
|
| 4512. |
Distinguish between ComboBox and ListBox. When would you prefer using them over Radiobutton and Checkbox? |
||||||
|
Answer» Differences between ComboBox Box and ListBox
You can use ComboBox over RadioButton while ListBox over CheckBox. |
|||||||
| 4513. |
Rewrite the following code using switch statement :if (code = = ‘A’)allowance = 3500 ;elseif (code = = ‘B‘)allowance = 3200 :elseallowance = 2000 : |
|
Answer» Given code using switch statement : switch (code) { case A ; allowance = 3500 ; break ; case B ; allowance = 3200 ; break ; default ; allowance = 2000 ; break ; } |
|
| 4514. |
Rewrite the following code using switch statement :if (code == 'A') allowance = 3500;else if (code == 'B') allowance = 3200;else allowance = 2000; |
|
Answer» Code using switch statement : switch (code) { case 'A' : allowance = 3500; break; case 'B' : allowance = 3200; break; default : allowance = 2000; } |
|
| 4515. |
What will be the final value of variable x after the following code is executed:int x=10;while(x>1){x=x/3;++x;} |
|
Answer» The value is: 1 |
|
| 4516. |
In the table "Student", Priya wanted to increase the Marks (Column Name : Marks) of those students by 5 who have got Marks below 33. She has entered the following statement :SELECT Marks + 5 FROM Student WHERE Marks<33;Identify errors (if any) in the above statement. Rewrite the correct SQL statement. |
|
Answer» Correct statement- UPDATE Student SET Marks = Marks * 5 WHERE Marks < 33; |
|
| 4517. |
The following code has error(s). Rewrite the correct code underlining all the corrections made :int start=2;end=20;do;{start=start+start;while(start<=end) |
|
Answer» int start=2,end=20; //Correction 1 do //Correction 2 { start=start+start; } //Correction 3 while(start<=end); //Correction 4 |
|
| 4518. |
Find the output of the following Java code snippet after execution of each java statement labelled as Line 1, Line 2, Line 3, Line 4:String userid="INDIA",pwd="";pwd=userid.substring(0,2); //Line 1int L=userid.length(); //Line 2pwd=pwd.toLowerCase(); //Line 3pwd=pwd.concat(""+L); //Line 4 |
|
Answer» The output is: IN 5 in in5 |
|
| 4519. |
Name the data type that should be used to store AccountCodes liko “A1001” of Customers |
|
Answer» varchar data type should be used to store AccountCodes like ”A100111 of customers. |
|
| 4520. |
(i) Name the Data type that should be used to store AccountCodes like "A1001" of Customers.(ii) Name two Data types that require data to be enclosed in quotes. |
|
Answer» (i) VARCHAR (ii) CHAR, DATE |
|
| 4521. |
Gives the table 'Player' with the following columns :Table: PlayerPCODEPOINTS1502NULL340Write the output of the following statements :(i) SELECT AVG (POINTS) FROM player;(ii) SELECT COUNT (POINTS) FROM player; |
|
Answer» Output (i) AVG (POINTS) 30 (ii) COUNT (POINTS) 2 |
|
| 4522. |
Given the table ‘Player’ with the following columns :Table : PlayerPCODEPOINTS1502NULL340Write the output of the following statements :(i) SELECT AVG(POINTS) FROM PIayer :(ii) SELECT C0UNT(POINTS) FROM Player : |
||||
|
Answer» Output of the given statements (i)
(ii)
|
|||||
| 4523. |
Name two data types that require data to be enclosed in quotes. |
|
Answer» char and date data types require data to be enclosed in quotes. |
|
| 4524. |
Identify the error in the following code :switch (c){case 9.0 : a = a + 2;break;case 8.0 :a = a + 3;break;} |
|
Answer» Variable ‘c’ cannot be of float/real data type. Note: Full 1 mark should be allotted if correct code is written Detailed Answer : Default case is missing in the given code which is used for performing a task when none of the cases are true. |
|
| 4525. |
Write the definition of functions for the linked implemented queue containing passenger information as follows: struct NODE{ int Ticketno;char PName[20];NODE * NEXT; };class Queueofbus{ NODE *Rear, *Front;public:Queueofbus(){ Rear = NULL;Front = NULL; };void Insert();void Delete();~Queueofbus(){ cout<<"Object destroyed"; }}; |
|
Answer» void Queueofbus::Insert() { NODE *p = new NODE; cout<<”Enter Ticket no” cin>>p->ticketno; cout<<”Enter Name”; cin>>p->Pname; p->NEXT = NULL; if (rear == NULL) { Rear = p; Front = Rear; } else { Rear -> NEXT = p; Rear = Rear -> NEXT; } } |
|
| 4526. |
An integer array A [30][40] is stored along the column in the memory. If the element A[20][25] is stored at 50000, find out the location of A[25][30]. |
|
Answer» A[i][j] = B+W x [No.of rows x(I-Lr)+(J-Lc)] A[20][25] = B+ 2x[30x(20-0)+(25-0)] 50000= B+2x[30x(20-0)+(25-0)] B = 48750 A[7][10] = 48750+ 2x[30x(7-0)+(10-0)] = 49190 |
|
| 4527. |
Answer the questions (i) and (ii) after going through the following class : class Exam{int Rollno;char Cname[25];float Marks ;public :Exam( ) //Function 1Rollno = 0 ;Cname=””;Marks=0.0;}Exam(int Rno, char candname) //Function 2{Rollno = Rno ;strcpy(Cname,candname);}~Exam( ) //Function 3{cout << “Result will be intimated shortly” << endl ;}void Display( ) //Function 4{cout << “Roll no :”<<Rollno;cout<<”Name :” <<Cname;cout <<” Marks:”<<Marks;}} ;(i) Which OOP concept does Function 1 and Function 2 implement.Explain?(ii) What is Function 3 called? When will it be invoked? |
|
Answer» (i) Constructor Overloading /Polymorphism, as multiple definitions for Constructors, are given in the same scope. Function 1 is a Default constructor and function 2 is a Parameterized constructor. (ii) Function 3 is a Destructor which is invoked when the object goes out of scope. |
|
| 4528. |
Give the following class definition answer the question that is follow:class University{char name [20];protected :char vc[20];public :void estd();void inputdata();void outputdata();}class College : protected University{ int regno;protectedchar principal()public :int no_of_students;void readdata();void dispdata ( );};class Department : public Collegechar name[20];char HOD[20];public :void fetchdata(int);void displaydata( ); }(i) Name the base class and derived class of college.(ii) Name the data member(s) that can be accessed from function displaydata.(iii) What type of inheritance is depicted in the above class definition?(iv) What will be the size of an object (in bytes) of class Department? |
|
Answer» (i) Base class: University Derived class: Department (ii) char name[20],char HOD[20], char principal(),int no_of_students, char vc[20] (iii) Multilevel Inheritance (iv) 85 bytes |
|
| 4529. |
Differentiate between data abstraction and data hiding. |
|
Answer» Data hiding can be defined as the mechanism of hiding the data of a class from the outside world. This is done to protect the data from any accidental or intentional access. Data hiding is achieved by making the members of the class private. Data abstraction refers to, providing only essential information to the outside world and hiding their background details. Members defined with a public label are accessible to all parts of the program. The data abstraction view of a type is defined by its public members. |
|
| 4530. |
Answer the question (i) & (ii) after going through the following code. (assume all necessary header files are included in program)(i) Give the name of the feature of OOP which is implemented by Function 1 & 2 together in the above class Game.(ii) Anuj made changes to the above class Game and made Function 3 private. Will he be able to execute the Line 1 successfully given below? Justify.void main(){Game ABC; //Line 1} |
|
Answer» (i) Polymorphism or Function Overloading or Constructor Overloading. (ii) Yes, an error “Destructor for Game is not accessible” will come. As there is a destructor defined in the class and it cannot be made private. |
|
| 4531. |
Answer the question from (i) to (iv) based on the given below code(assume all necessary header files are included in program):-(i) Write name of the class whose constructor is invoked first on the creation of a new object of class Country.(ii) Write name of the data members which are accessible through the object of class Country.(iii) List name of the members which are accessible through the member function “void New_Country()”.(iv) What will be the size(in bytes) of an object of class Country & State respectively. |
|
Answer» (i) class City (ii) None (iii) Data members: Country_Id, Country_Name[25], State_Population, City_Population Member functions: Display_Country(), New_State(), Print_State(), Get_Population(), New_City(), Show_City() (iv) 90 bytes for object of class Country & 63 bytes for object of class State |
|
| 4532. |
Identify the error in the following code :switch (c){case 9.0 : a = a + 2; break;Case 8.0 : a = a + 3; break;} |
|
Answer» default case is missing in the given code which is used for performing a task when none of the cases are true. |
|
| 4533. |
Write the code given below using ‘for’ loop instead of ‘while’ loop :int i = 1 ;while (i <= 5) {if (i *i = = 4)jTextFieldl. setText(" " + i) ; i = i + 1 ;} |
|
Answer» The given code using ‘for’ loop instead of ‘while’ loop : int i for (i = 1 ; i < = 5 ; i + +) { if (1 * i = = 4) jTextFieldl. setText ( “ “ + i) ; } |
|
| 4534. |
What values will be displayed in JOptionPane when the following code is executed?int a = 5, b = 2 ; while (a < 20) { a = a + b ; b = a - b ; JOptionPane. showMessageDialog(null,a) ; } |
|
Answer» No value will be displayed in JOptionPane because it will give exception in thread ‘main’ due to null. |
|
| 4535. |
Write the value that will be stored in variable a after execution of the following code if :(i) initial value of a is 8.(ii) initial value of a is 10.int b = 9;if (a > b)a = a + 5;a = a + 2; |
|
Answer» (i) 10 (ii) 17 |
|
| 4536. |
What will be the values of i and z after the following code is executed :int i = 0 ;int z = 10 ; do{ i = i + 2 ; z - - ; }while (i < 10) ; |
|
Answer» Value of i = 10 Value of z = 5 |
|
| 4537. |
What will be the values of i and z after the following code is executed :int i = 0;int z = 10;do{i = i + 2;z – –;}while (i < 10); |
|
Answer» i = 10 z = 5 |
|
| 4538. |
What is the purpose of logical address of computer? |
|
Answer» In computing, a logical address is a address at which an item appears to be reside from the perspective of an executing application. It helps to easily develop an application for the programmer. |
|
| 4539. |
Consider the following table 'Furniture'.Write SQL commands for the statements (i) to (viii) and write output for SQL queries (ix) and (x). Table : FurnitureFCODENAMEPRICEMANUFDATEWCODE10023Coffee table400019-DEC-2016W0310001Dining table2050012-JAN-2017W0110012Sofa3500006-JUN-2016W0210024Chair250007-APR-2017W0310090Cabinet1800031-MAR-2015W02(i) To display FCODE, NAME and PRICE of items that have Price less than Rs. 5,000.(ii) To display NAMES and PRICE of those Furniture Items that have 'table' anywhere in their names.(iii) To display WCode of Furniture Items. There should be no duplicate values.(iv) To display the NAMES and PRICE increased by 500.00 of all the furniture items. (Price should only be displayed as increased; there should be no increase in the data in the table).(v) To display FCODE and NAME of each Furniture Item in descending order of FCODE.(vi) To display the details of all the Furniture Items which have Manufacturing date (MANUFDATE) between 01-JAN-2016 and 15-JUN-2017 (inclusive of both the dates).(vii) To display the average PRICE of all the Furniture Items, which are made of Wood with WCODE as W02.(viii) To display WCODE wise, WCODE and the highest price of Furniture Items.(ix) SELECT SUM (PRICE) FROM Furniture WHERE WCODE = 'W03'; (x) SELECT COUNT (DISTINCT PRICE) FROM Furniture; |
|
Answer» (i) SELECT FCODE, NAME,PRICE FROM Furniture WHERE PRICE <5000; (ii) SELECT NAME,PRICE FROM Furniture WHERE NAME LIKE ‘%table%’; (iii) SELECT DISTINCT(WCODE) FROM Furniture; (iv) SELECT NAME, PRICE+500 FROM Furniture; (v) SELECT FCODE, NAME FROM Furniture ORDER BY FCODE DESC; (vi) SELECT * FROM FURNITURE WHERE MANUFDATE BETWEEN ’2016-01-01’ AND ’2017-06-15’; OR SELECT * FROM FURNITURE WHERE MANUFDATE >= ’2016-01-01’ AND MANUFDATE <= ’2017-06-15’; OR SELECT * FROM FURNITURE WHERE MANUFDATE BETWEEN ’01-JAN-2016’ AND ’15-JUN-2017’; OR SELECT * FROM FURNITURE WHERE MANUFDATE >= ’01-JAN-2016’AND MANUFDATE <=’15-JUN-2017’; (vii) SELECT AVG(PRICE) FROM Furniture WHERE WCODE = ‘W02’; (viii) SELECT WCODE, MAX(PRICE) FROM Furniture GROUP BY WCODE; (ix) SUM(PRICE) 6500 (x) COUNT(DISTINCT PRICE) 5 |
|
| 4540. |
If closing stock appears in the trial balance, it should be a) Credited to the trading account b) Credited to the profit and loss account c) Deducted from the purchases in the trading account d) Shown on the liability side of the Balance sheet |
|
Answer» a) Credited to the trading account |
|
| 4541. |
The reduction in the value of the fixed assets which can arise due to time factor is a)Discount b) Depreciation c)Reduction d) None of the above |
|
Answer» b) Depreciation |
|
| 4542. |
Which of the following account balance will be shown on debit side of Trial Balance? a) Outstanding expenses b) Cash a/c c) Short term loan d) creditors |
|
Answer» d) creditors |
|
| 4543. |
What comes in is to be debited, what goes out is to be credited. a) Rules of Personal b) Rules of Real c) Rules of Nominal d) All of these |
|
Answer» b) Rules of Real |
|
| 4544. |
Purchases of goods on credit from A is recorded as: a) Debit purchases a/c; credit cash a/c b) Debit A a/c ;credit purchases a/c c) Debit purchases a/c ; credit A a/c d) Debit A a/c ; credit stock a/c |
|
Answer» c) Debit purchases a/c ; credit A a/c |
|
| 4545. |
Journal Entries are known as book of ……Entry. a) Original b) Duplicate c) Personal d) Nominal |
|
Answer» Journal Entries are known as book of Original Entry |
|
| 4546. |
Book keeping is an………of correctly recording of business transition. a) Art and Science b) Art c) Science d) Art or Science |
|
Answer» Book keeping is an Art of correctly recording of business transition. |
|
| 4547. |
Which of the following is not an example of real a/c: a) Machinery b) Building c) Cash d) Creditor |
|
Answer» Creditor is not an example of real a/c: |
|
| 4548. |
Payment received from debtor: a) Decreases the total assets b) Increases the total assets c) Results in no change in total assets d) Increase the total liabilities |
|
Answer» c) Results in no change in total assets |
|
| 4549. |
Payment received from Debtor a) Decreases the Total Assets b) Increases the Total Assets c) Results in no change in the Total Assets d) Increases the Total Liabilities |
|
Answer» c) Results in no change in the Total Assets |
|
| 4550. |
Quick assets do not include a) Govt.bond b) Book debts c) Advance for supply of raw materials d) Inventories. |
|
Answer» d) Inventories. |
|