MEDIUM
Earn 100

 What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main() {

    if (0) {
        cout << "Hello" ;
    }
    else 
    {
        cout << "Good Bye" ;
    }
    return 0;
}

33.33% studentsanswered this correctly

Important Questions on C Language and OOP

MEDIUM

int main()
{
    int i=0;
     
    for (i = 1; i <= 10; i++)
    {
        printf( "Hello World\n");   
    }
 
    return 0;
}

Identify the test condition and how mony times the for loop will execute?

MEDIUM

Find the output of the given C program.

#include<stdio.h>
int main()
{
  if(-5)
  printf("a");
  printf("b");
  else
  printf("c");
  printf("d");
  return 0;
}

MEDIUM
What is the output of the following code:
void main()
{
int 5;
for(i=5;i<=15;i++)
 printf(“%d\n”,i);
}
 
EASY

The secant method is used to find the root of an equation fx=0. It is started from two distinct estimates xa and xb for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if fxb is very small and then xb is the solution. The procedure is given below. Observe that there is an expression which is missing and is marked by ?. Which is the suitable expression that is to be put in place of ? so that it follows all steps of the secant method?

Secant

Initialize: xa, xb, ε, N       // ∈= convergence indicator

                                     // N= maximum no. of iterations

fb=fxb

i=0

while (i<N and fb> do

          i=i+1            // update counter

          xt=?               // missing expression for

                                   // intermediate value

            xa=xb        // reset xa

           xb=xt           // reset xb

          fb=fxb       // function value at new xb end while

      if    fb> then       // loop is terminated with i=N

                 write “Non-convergence”

 else

            write “return xb

     end if

MEDIUM

What will be the output of the following C code?

#include <stdio.h>

int main(){
    int a = 11;
    
    while (a < 20) {
        printf("%d  ", a);
        a += 2;
    }
    
    return 0;
}

MEDIUM

for(int i = 0; i < n; i++){

print(i);
}

Identify the initialisation expression in for loop.

HARD

 What is the output of the C Program.?

int main()
{
    if( 4 > 5 )
    {
        printf("Hurray..\n");
    }
     printf("Yes");

    return 0;

}

MEDIUM
Which of the following shell script's looping features does not recognise the break command?
MEDIUM
Study the following statement
if a>b
if c>b
printf ("one")
else
if c=aprintf ("two");
else printf ("three");
else printf ("four");
The above statement can never print