Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

The data structure in which elements are arranged in non-sequence is named as type of data structure. (a) Heterogeneous data structure (b) Synthetic data structure (c) Linear data structure (d) Non-linear data structure

Answer»

Correct answer is (c) Linear data structure

2.

Consider the following two statements. (i). Memory of size dynamic data structures can be changed during execution. (ii). Static data structures are associated with primary memory (a) Statement (i) and statement (ii) are not true (b) Statement (i) is true and statement (ii) is false (c) Statement (i) is false and statement (ii) is true (d) Statement (i) and statement (ii) are false

Answer»

(a) Statement (i) and statement (ii) are not true

3.

A stack can be grow or shrink, so it can be considered as ………… data structure.

Answer»

A stack can be grow or shrink, so it can be considered as dynamic data structure. 

4.

Explain why linked lists do not face an overflow situation as in the case of array based data structures.

Answer»

The linked list follows the dynamic data structure method. It grows and shrinks as and when the new items are added and removed respectively. Not only that an array requires contiguous memory but a linked list not require contiguous memory rather it uses scattered memory and they linked by pointers. So an element in a linked list consists of data and an address it is called a node. Here address is the link.

5.

Match the following:  A   B  Ca. Arrayi. Start1. Insertion and deletion at different endsb. Stackii. Subscript2. Insertion and deletion at the same endc. Queueiii. Rear3. Self-referential structure is utilizedd. Linked listiv. Top4. Elements are accessed by specifying its position

Answer»

(a) – ii – 4 

(b) – iv – 2

(c) – iii – 1 

(d) – i – 3

6.

Name the attribute used to merge two or more rows of a table in an HTML document.

Answer»

Rowspan attribute used to merge two or more rows of a table in an HTML document.

7.

Write the equivalent code for the following statement R=(P<Q?P:Q)

Answer»

if(P<Q)

R=P;

else

R=Q;

8.

Which of the following is the correct way to create an email link?(a) &lt;A href= “[email protected]”&gt;(b) &lt;mail href= “[email protected]”&gt;(c) &lt;mail&gt; “[email protected]”&gt;(d) &lt;A href= “mailto: [email protected]”&gt;

Answer»

(d) <A href= “mailto: [email protected]”>

9.

Write a program to convert temperature from Celsius to Fahrenheit.

Answer»

#include

using namespace std;

int main()

{

float c,f;

cout<<"Enter the temperature in Celsius:";

cin>>c;

f=1.8*c+32;

cout<<" Degree Celsius "<<f<<"Degree Fahrenheit" ;

}

10.

Write a program to find the area of a triangle.

Answer»

#include

using namespace std;

int main()

{

int b,h;

float area;

cout<<"Enter values for b and h";

cin>>b>>h;

area=0.5*b*h;

cout<<" The area of a triangle is "<<area;

}

11.

Write a program to read weight in grams and convert it into Kilogram.

Answer»

#include

using namespace std;

int main()

{

float gm,kg;

cout<<"Enter the weight in grams:";

cin>>gm;

kg=gm/100;

cout<<gm<<" grams = "<<kg<<"Kilogram" ;

}

12.

Name the principle by which tickets are issued in a Cinema Ticket counter. Which data structure supports this principle?

Answer»

It is an example for Queue. Here the persons are added at the back end and tickets are issued to the front end. The FIFO method is used.

13.

Each node containing data and a pointer to the next node is applicable with ………. data structure.(a) Array (b) Linked List (c) Stack (d) Queue

Answer»

Correct answer is (b) Linked List

14.

Identify and correct mistake in the following Stack – PUSH algorithm, start if stack is full return null endif top = top -1 stack[top] = data stop

Answer»

top = top – 1 is to be replaced by top = top + 1

15.

A word, say “computer” is stored in an array. Another array is to be created by storing the reverse of the word. How can stack support you to perform this task? Explain the algorithm.

Answer»

This can be performed by pushing each character of the word “computer” onto a stack as it is read. After the word is finished, then the characters are popped o the stack, so they will come in the reverse order such as “retupmoc” in the desired output.

16.

People waiting in a cinema theatre counter for taking tickets is an example for ……(a) stack (b) queue (c) array (d) none of these

Answer»

Correct answer is (b) queue

17.

Write the steps for deleting a node from a linked list?

Answer»

Deletion from a linked list It is the removal of a node from the data structure. 

Step 1: Get the address of the previous node (POS – 1) and next node (POS + 1) in the pointers Pre-Node and Post-Node respectively. 

Step 2: Copy the contents of Post-Node into the link part of node at position (POS -1)

Step 3: Free the node at position POS.

18.

Write the steps for deleting an element from a queue

Answer»

Deletion operation It is. the process of deleting(removing) a data item. from the queue from the front. If the queue is empty ‘ v ‘.and we try to delete an item from the queue makes 1 the queue under-row. Algorithm is given below

Step 1: If front = Null then print “UNDERFLOW: and return 

Step 2: Set item = Queue [front] 

Step 3: If front = Null and rear = Null Else if front N then set front = 1 Else Set front = front + 1 End if 

Step 4: stop

19.

Rewrite the following C++ code using conditional operator.if (a&gt;b)max=a;elsemax=b;

Answer»

max=(a>b)?a:b;

20.

Compare if else and conditional operator?

Answer»

We can use conditional operator as an alternative of if-else statement. The conditional operator is a ternary operator. 

The syntax of if-else

if (expression 1)

expression 2;

else

expression 3;

First expression 1 is evaluated if it is true

expression 2 will be executed otherwise

expression 3 will be executed. Instead of this,

we can be written as follows using conditional operator Expression 1? expression 2: expressions;

21.

Two pairs C++ expressions are given below. 1. a=10, a==10 2. b=a++, b=++a How do they differ? What will be the effect of the expression

Answer»

1. = is an assignment operator that assigns a value 10 to the LHS (Left Hand Side)variable a But == is equality operator that checks whether the LHS and RHS are equal or not. If it is equal it returns a true value otherwise false

2. In a++,++is a post(means after the operand) increment operator and in ++a, ++ is a pre(means before the operand) increment operator. They are entirely different. 

Post increment: 

Here first use the value of ‘a’ and then change the value of ‘a’. 

Eg: if a= 10 then b=a++. After this statement b= 10 and a=11 

Pre increment: 

Here first change the value of a and then use the value of a.

Eg: if a=10 then b=++a. After this statement b=11 and a=11.

22.

Rewrite the following using nested switch construct. #includeusing namespace std;int main(){int a,bcout&lt;&lt;"Enter values for a and b";cin&gt;&gt;a&gt;&gt;b;if(b==0)cout&lt;&lt;"Divide by zero error";elseif(a==0)cout&lt;&lt;"The result is zero";elsecout&lt;&lt;"The result is "&lt;&lt;(float)a/b;}

Answer»

#include

using namespace std;

int main()

{

int a,b

cout<<"Enter values for a and b";

cin>>a>>b;

switch(b)

{

case 0:cout<<"Divide by zero error";

break;

default:

switch(a)

{

case 0:cout<<"The result is zero";

break;

default:

cout<<"The result is "<<(float)a/b;

}

}

}

23.

Rewrite the program following program usingif else#includeusing namespace std;int main(){int a,b,big;cout&lt;&lt;"Enter two integers";cin&gt;&gt;a&gt;&gt;b;big=(a&gt;b)?a:b;cout&lt;&lt;"Biggest number is "&lt;&lt;big&lt;&lt;endI;return 0;}

Answer»

# include

using namespace std;

int main()

{

int a,b,big;

cout<<"Enter two integers";

cin>>a>>b;

if(a>b)

big=a;

else

big=b;

cout<<"Biggest number is "<<big<<endI;

return 0;

}

24.

Varun is creating a web page. He wants to create a link on the text ‘sample’ to a le named sample, htm which resides in a sub directory named Exam of the D drive. Write the HTML command for this purpose.

Answer»

<A Href = “D:\Exam\sample.htm”>

Sample</A>

25.

......... function is used to return the data type.

Answer»

typeof() function is used to return the data type.

26.

A link to a particular section of the same document is called ……

Answer»

Internal linking.

27.

Which HTML tag is used to create ordered list?

Answer»

<ol> is used to create ordered list.

28.

Write valid reasons after reading the following statements in C++ and comment on their correctness by give reasons. 1. char num = 66; char num – B’; 2. 35 and 35L are different 3. The number 14,016 and OxE are one and the same 4. Char data type is often said to be an integer type 5. To store the value 4.15 float data type is preferred over double

Answer»

1. The ASCII number of B is 66. So it is equivalent. 

2. 35 is of integer type but 35L is Long 

3. The decimal number 14 is represented in octal is 016 and in hexadecimal is OxE. 

4. Internally char data type stores ASCII numbers. 

5. To store the value 4.15 oat data type is better because float requires only 4 bytes while double needs 8 bytes hence we can save the memory.

29.

Rewrite the above code using if else if ladder.#include using namespace std; int main(){int n;cout&lt;&lt;"Enter a number in between 1-7";cin&gt;&gt;n;switch(n){case 1: cout&lt;&lt; "Sunday";break;case 2: cout&lt;&lt; "Monday";break;case 3: cout&lt;&lt; "Tuesday";break;case 4: cout&lt;&lt; "Wednesday";break;case 5: cout&lt;&lt; "Thursday";break;case 6: cout&lt;&lt; "Friday";break;case 7: cout&lt;&lt; "Saturday";break;default : cout&lt;&lt;"Invalid"}}

Answer»

#include 

using namespace std; 

int main()

{

int n;

cout<<"Enter a number in between 1-7:";

cin>>n;

if(n==1)

cout<< "Sunday";

else if(n==2)

 cout<< "Monday";

else if(n==3)

cout<< "Tuesday";

else if(n==4)

cout<< "Wednesday";

else if(n==5)

cout<< "Thursday";

else if(n==6)

cout<< "Friday";

else if(n==7)

cout<< "Saturday";

else

cout<<"Invalid";

}

}

30.

Consider the following code# include using namespace std; int main(){int mark; cout&lt;&lt;"Enter a mark";cin&gt;&gt;mark;if (mark&gt;=75)     cout&lt;&lt;"Distinction";else if (mark&gt;=60)        cout&lt;&lt;"First class";else if (mark&gt;=50)        cout&lt;&lt;"Second class";else if (mark&gt;=40)       cout&lt;&lt;"passed";else      cout&lt;&lt;"Failed";}Is it possible to rewrite the above program using switch statement? Distinguish between switch and if else if ladder. 

Answer»

No. It is not possible to write the above code using switch statement.

Following are the difference between switch and if else if ladder. 

1. Switch can test only for equality but if can evaluate a relational or logical expression 

2. If else is more versatile 

3. If else can handle floating values but switch can not 

4. If the test expression contains more variable if else is used 

5. Testing a value against a set of constants switch is more efficient than if else

31.

Match the following numbers and data types in C++ to form the most suitable pairs. 1. 142789 a. Signed 2. 240 b. Double 3. -150 c. Long int 4. 8.4 × 10-4000 d. Float 5. 0 e. Long double 6. 0.0008 f. Unsigned short 7. -127 g. Short int 8. 2.8 × 10308 h. Signed char

Answer»
1. 142789 a. Long int
 2. 240 b. Short int
 3. -150 c. Signed
 4. 8.4 × 10-4000 d. Long double
 5. 0 e. Unsigned short
 6. 0.0008 f. Float
 7. -127 g. Signed char
 8. 2.8 × 10308 h. Double
32.

Analyses the following statements and write Time or False. Justify 1. There is an Operator in C++ having no special character in it 2. An operator cannot have more than 2 operands 3. Comma operator has the lowest precedence 4. All logical operators are binary in nature5. It is not possible to assign the constant 5 to 10 different variables using a single C++ expression 6. In type promotion the operands with lower data type will be converted to the highest data type in expression

Answer»

1. True (size of operator) 

2. False( conditional operator can have 3 operands 

3. True 

4. False 

5. False(Multiple assignment is possible, 

eg: a=b=c=___=5) 

6. True

33.

Considering the following C++ statements. Fill up the blanks 1. lf p=5 and q=3 then q%p is ........ 2. If E1 is true and E2 is False then E1 &amp;&amp; E2 will be ....... 3. If k=8, ++k &lt;= 8 will be ......... 4. If x=2 then (10* ++x) % 7 will be ........5. If t=8 and m=(n=3,t-n), the value of m will be ....... 6. If i=12 the value i after execution of the expression i+=i– + –i will be .......

Answer»

1. 3 

2. False 

3. False(++k makes k=9. So 9<=8 is false) 

4. 2(++x becomes 3, so 10 * 3 =30%7 =2) 

5. 5( here m=(n=3,8-3)=(n=3,5), so m=5, The maximum value will take) 

6. Here i=12

i + = i– + –i 

here post decrement has more priority than pre decrement. So i — will be evaluated first. Here first uses the value then change so it uses the value 12 and i becomes 11 

i + =12 + –i 

now i =11.

Here the value of i will be changed and used so i– becomes 10

i + = 12 + 10 

= 22

So i = 22 + 10

i = 32

So the result is 32.

34.

While designing a web page Raju wants to display a table which occupies the full browser window. Name the attribute which help him to do so.

Answer»

The attribute is Width,it can be given in percentage of total window width.

Eg. <Table Border = 1 width = "100%">

35.

Suggest most suitable derived data types in C++ for storing the following data items or statements 1. 0 Age of 50 students in a class 2. Address of a memory variable 3. A set of instructions to nd out the factorial of a number 4. An alternate name of a previously defined variable5. Price of 100 products in a consumer store 6. Name of a student

Answer»

1. Integer array of size 50 

2. Pointer variable 

3. Function 

4. Reference 

5. Float array of size 100 

6. Character array

36.

Create a web page using frames for Tourism department showing list of tourist places in Kerala. When a place is selected a detailed description should be available in a separate window.ORCreate a form that accepts information regarding a student. Fields necessary are name, age, class, sex, roll number, hobbies and date of birth. Use appropriate form controls.

Answer»

By using target property ,we can design like this. Consider the following five files.

Step 1. Take a notepad and type the following and save it as main.html on C:\

<html>

<head>

<title>

Tourist places in Kerala

</title>

</head>

<body bgcolor=”cyan”>

<h1><u><b><center>Tourist Places in Keral<ol>

<li><a href=”tvm.html” target=”f2">Thiruvar

<li><a href=”ekm.html” target=”f2">Emakula

<li><a href=”clt.html” target=”f2">Calicut</a

</ol>

</body>

</html>

Step 2. Take a notepad and type the following and save it as tvm.html on C:\

<html>

<head>

<title>

Tourist places in Kerala

</title>

</head>

<body bgcolor=”cyan”>

<h1><u><b><center>Thiruvanathapuram</>

<li>Kovalam</li>

<li>zoo</li>

<li>Padmanabha Swami Temple</li></ul>

</body>

</html>

Step 3. Take a notepad and type the following and save it as ekm.html on C:\

<html>

<head>

<title>

Tourist places in Kerala

</title>

</head>

<body bgcolor=”cyan”>

<h1><u><b><center>Emakulam</center></

<ul>

<li>Bolghatty Palace</li>

<li>ShipYard</li>

<li>Marine Drive</li>

</ul>

</body>

</html>

Step 4. Take a notepad and type the following and save it as clt.html on C:\

<html>

<head>

<title>

Tourist places in Kerala

</title>

</head>

<body bgcolor=”cyan”>

<h1><u><b><center>Calicut</center></b>

<ul>

<li>Kappad Beach</li>

<li>Planetorium</li>

<li>Mananchira</li>

</ul>

</body>

</html>

Step 5. Take a notepad and type the following and ‘ save it as frame.html on C:\

<html>

<head>

<title>

fiame

</title>

<fiameset cols="33%,*">

<fiame src="main.html>

<fiame src=tvm.htmr name=”f2">

</fiameset>

</html>

Step 6. Execute frame.html we will get the output.

OR

<html>

<head>

<title>

form

</title>

<body bgcolor="cyan">

<form method=”post” action=”fa.php”>

<h1><u><center><b>Application Form </b:Name&nbsp;&nbsp; 

<input type="text” name="txtname”>

<br>

Age&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br>

Class &nbsp;&nbsp;&nbsp;

<input type=”text” name=”txtclass”>

<br>

Sex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

Male<input type=”radio” name=”optsex” val>

Female<input type=”radio” name=”optsex” val>

<br>

Roll No

<input type=”text” name=”txtroll” size=”1 ">

<br>

Hobbies

Reading<input type=”checkbox” name=”cbr

Singing<input type=”checkbox” name=”cbsin

Playing<input type=”checkbox” name=”cbpl

<br>

Date of Birth

<input type=”text” name=”txtdob” size=”1 ">

<br><br>

<in put ty pe=”subm it” val ue=”su bmit”>

<input type=”reset” value=”reset”>

</form>

</body>

</html>

37.

In JavaScript, a variable is declared using the keyword ..........

Answer»

In JavaScript, a variable is declared using the keyword var

38.

We know that an HTML document contains two sections head and body section. While designing a web page as follows what will happen?

Answer»

<html>

<head>

</head>

<body>

<frameset cols=”50%,*”>

<frame src=”page1 .html” noresize> <frame src=”page2.html”>

</frameset>

</body>

</html>

There is no output because a <frameset> tag has no body tag. It is very important. So

the correct code is as follows,

<html>

<head>

</head>

<frameset cols=”50%,*”>

<frame src=”page1 .html” noresize>

<frame src=”page2.html”>

</frameset>

</html>

39.

Mr. Sonet visited a website that contains two frames. He tries to resize the first frame by mouse. But he failed to do so. What is the reason behind. Explain?

Answer»

This is because the web designer used Noresize attribute of frame tag while he design the page. No resize attribute stops the resizing of the frame, no value is to be assigned.

Eg: <frame src=”page1.html” noresize>

40.

Create a web page as follows to display a list contains items.

Answer»

To create a list box set the size property of <Select> tag to more than 1.

<html>

<head>

</head>

<body>

House Hold ltems<Br>

<select size=3>

<option>TV

<option>Fridge

<option selected>Washing Machine </select>

</body>

</html>

41.

In VB there are separate controls to create List Box and Combo Box. But in HTML these controls can be created by using a single tag.1. Name the tag used for this?2. Which attribute is used for this and how?

Answer»

1. < SELECT >

2. Size attribute
< SELECT Size = 1> gives combo box
< SELECT Size = 3> gives a list box

42.

Write the HTML code for creating the following web page using List tag.Computer TermsCPUCentral processing UnitALUArithmetic and logic UnitWWWWorld Wide Web

Answer»

HTML>

<HEAD>

<TITLE>Definition List Tag</TITLE>

</HEAD>

<BODY>

<H1 Align= “center“><B>COMPUTER TERMS</B>< H1><BR>

<DL>

<DT>CPU

<DD>Central Processing Unit <DT>ALU

<DD>Arithmetic and Logic Unit <DT>WWW <DD>World Wide Web </DL>

</BODY>

</HTML>

43.

Write HTML code for creating the following webpage using tag.Net Link Ltd. BangaloreOur Products1. Television2. Washing MachineModel 2005XP SeriesModel 2006ST Series

Answer»

<HTML>

<HEAD>

<TITLE>List Tag</TITLE.

</HEAD>

<BODY>

<H2 Align=”centre” ><B>Net Link Ltd></ B><H2><BR>

<H2 Align=”centre”><B>Bangalore></B></H2><BR>

<HR>

<B>Our products</B>

<BR>

<OLtype=1>

<LI>Television <LI>Washing Machine <UL>

<LI><Model 2005XP Series <LI> Model 2006 ST Series </UL>

</OL>

</Body>

</HTML>

44.

Create an HTML page as shown below using lists.The recipe for preparation1. The ingredients• 100g flour• 10g sugar• 1 cup water• 2 egg• Salt and pepper2. The procedureA. Mix dry ingredients thoroughlyB. Pour in wet ingradientsC. Mix for 10 mtsD. Bake for 1 hr at 100 degree C temperature &lt;HTML&gt;

Answer»

<HTML>

<HEAD>

<TITLE>

List Demo </TITLE>

</HEAD>

<BODY Bgcolor = “Green”>

The recipe for preparation <OL>
<LI> The ingredients </LI>

<ULtype=”disc”>

<LI> 100 g flour </LI

<LI> 10 g Sugar </LI>

<LI> 1 cup water </LI>

<LI>2egg </LI>

<LI> Salt and pepper </LI>

</UL>

<LI> The procedure </LI>

<OL TYPE =”A”>

<LI> Mix dry ingredients thoroughly </LI>

<LI> Pour in wet ingredients </LI>

<LI> Mix for 10 mts </LI>

<LI> Bake for 1 hr at 100 degree C temperature </LI>

</OL>

</OL>

</BODY>

</HTML>

45.

Explain the attributes of &lt;TH&gt; and &lt;TD&gt;?

Answer»

1. Align: It specifies the horizontal alignment of the content, the values can be left, right, center and justify.

2. Valign: It specifies the vertical alignment of the content, the values can be top, middle, Bottom, and baseline.

3. Bgcolor: It specifies the background colour for the cell.

4. Colspan: It is used to span or to stretch a cell over a number of columns. 

Eg: <TD Colspan=3> spans the cell over three columns

5. Rowspan: It is used to span or to stretch a cell over a number of rows.

Eg: <TD Rowspan=3> spans the cell over three rows.

46.

Explain the attributes of &lt;Table&gt; tag?Name any six attributes of &lt;table&gt; tag that determine the general layout of table.

Answer»

1. Border: It specifies the thickness of the border lines around the table

2. Bordercolor: It specifies the colour for border lines

3. Align: It specifies the table alignment, the values can b,e left, right or center

4. Bgcolor: It specifies the back ground colour for the table.

5. Cellspacing: It specifies the space between two table cells

6. Cellpadding: It specifies the space between cell border and content

7. Cols: It specifies the number of columns

8. Width: It determines the table width

9. Frame: It specifies the border lines around the table, values are void, border, box, above, below,…

47.

Create HTML code for the following output.1. FlowersJasmineRoseLily2. VegetablesBeetrootCabbageCucumber3. FruitsAppleOrangePineapple

Answer»

<HTML>

<HEAD>

<TITLE>

Nested List </TITLE>

</HEAD>

<BODY Bgcolor = “Blue”> <OL>

<LI> Flowers </LI>

<UL TYPE=”disc”>

<LI> Jasmine </LI>

<LI> Rose </LI> <LI>Lily</LI>

</UL>

<LI> Vegetables </LI>

<ULTYPE=”disc”>

<LI>Beetroot</LI>

<LI>Cabbage</LI>

<LI>Cucumber</LI>

</UL>

<LI> Fruits</LI>

<OL type=T> <LI>Apple</LI> <LI>Orange</LI> <LI>Pineapple</LI>

</OL> </OL>

</BODY>

</HTML>

48.

Explain any three attributes of &lt;FORM&gt;tag.

Answer»

1. Action – Here we give the name of program (including the path) stored in the Webserver.

2. Method – There are 2 types of methods get and post.

Get methodPost method
1. Faster1. Slower
2. To send small volume of data2. To send large volume of data
3. Less secure3. More secure
4. Data visible during submission4. Data not visible during submission

3. Target – Specifies the target window for displaying the result. Values are given below.

  • _blank-Opens in a new window
  • _self-Opens in the same frame
  • _parent – Opens in the parent frameset
  • _top-Opens in the main browser window
  • name – Opens in the window with the specified name.
49.

How is dynamic memory allocation different from static memory allocation?

Answer»

In the static memory allocation, the amount of memory to be allocated is predicted and pre known. This memory is allocated during the compilation itself. All the declared variables declared normally, are allocated memory statically. 

In the dynamic memory allocation, the amount of memory to be allocated is not known beforehand. It is allocated during run time as and when required. The memory is dynamically allocated using new1 operator. 

The objects that are allocated memory statically have the lifetime as their scope allows, as decided by the compiler. And the objects that are allocated memory dynamically have the lifetime as decided by the programmer. That is until the programmer explicitly deallocates the memory, such objects live in the memory.

50.

Wrong customs and traditions cause the …………. of some sections of society. (a) encouragement (b) neglect (c) loss

Answer»

Correct option is (b) neglect