
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;
}
using namespace std;
int main() {
cout << "Hello" ;
}
else
{
cout << "Good Bye" ;
}
return 0;
}

Important Questions on C Language and OOP
Nested if…else statement can be replaced by the statement of ___


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?

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;
}

void main()
{
int 5;
for(i=5;i<=15;i++)
printf(“%d\n”,i);
}

The secant method is used to find the root of an equation . It is started from two distinct estimates and for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if is very small and then 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: , , ε, N // convergence indicator
// maximum no. of iterations
while and do
// update counter
// missing expression for
// intermediate value
// reset
// reset
// function value at new end while
if then // loop is terminated with
write “Non-convergence”
else
write “return ”
end if



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;
}



for(int i = 0; i < n; i++){
print(i);
}
Identify the initialisation expression in for loop.


What is the output of the C Program.?
int main()
{
if( 4 > 5 )
{
printf("Hurray..\n");
}
printf("Yes");
return 0;
}



if
if
printf ("one")
else
if printf ("two");
else printf ("three");
else printf ("four");
The above statement can never print

