Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 242 - 244 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 242

C & C Plus Plus

Question

MCQ▾
  1. voidmain ()
  2. {
  3.     floatj;
  4.     j =1000 ⚹1000;
  5.     printf ( “%f”, j);
  6. }

Choices

Choice (4)

a.

Overflow

b.

1000000.000000

c.

Error

d.

None of the above

Answer

b.

Explanation

In the program

Table Showing the Program
float j;
  • Define the float variable j
j = 1000 ⚹ 1000;
  • Here j = 1000 ⚹ 1000 = 1000000
printf ( “% f” , j) ;
  • Print the value if j = 1000000.000000

Question 243

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is a concrete class?

Explanation

  • A concrete class defines useful object that can be instantiated as an automatic variable on the program stack.
  • The implementation of a concrete class is defined.
  • It is not intended to be a base class.
  • Concrete is the default type of class such class can have direct instances.
  • A derived class that implements all the missing functionality is the concrete class in inheritance.
Given the Concrete Classes of Shape Class

Question 244

C & C Plus Plus
Edit

Describe in Detail

Essay▾
  1. main ()
  2. {
  3.     inti =1;
  4.     while (i ⇐ 5)
  5.     {
  6.         printf ( “%d” i);
  7.         if (i>=2)
  8.         gotohere;
  9.         i ++;
  10.     }
  11. }
  12. fun ()
  13. {
  14.     here:
  15.     Printf ( “PP” );
  16. }

Explanation

  • In a program
Table Shows the Program
int i = 1;Assign the integer i = 1
while (i ⇐ 5)

{

Check the while condition is true or false

I value put in while loop

While (1 <= 5)

{

The condition is true

Then apply next step

printf ( “% d” i) ;Print the value of i = 1
if (i > 2)

goto here;

i ++ ;

Check if condition

Here i = 1 , if (1 >= 2) condition false than apply

i ++ = 2

then apply first to check while loop

while (2 ⇐ 5)

{

printf ( “% d” i) ;

if (2 >= 2)

here condition is true so apply next step

goto here;

  • The label ‘here’ is available in function fun () hence it is not visible in function main () .
  • So, the answer is Compiler error: Undefined label ‘here’ in function main.

Developed by: