C++ Quiz

C++ Itreation Quiz

Q.1 What is the output of the following program code(Assume header files already declared) ?
      for(i=0;i<=10;i++);
      {
         printf("%d",i);
      }
Options
A.0,1,2,3,......10
B.10
C.11
D.Compile time error

View Answer

C++ String Quiz

Q.1 How we can get string as an input in C++
A. cin
B. cout
C. getline()
D. scanf()


Q.2 How we can assign null value to string in c++
A. NULL
B. null
C. ''
D. ""



Programming Section

1. Learn the use of break and continue statement using this c++ program.

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int i;
for(i=1;i<=10;i++)
{
if(i==4)
{         
      // 4 number is skipped.
continue;
}
if(i==9)
{
// loop breaks and control goes out of for loop
break;
}
cout<<i<<"\n";
}
return 0;
}


Output

1
2
3
5
6
7
8

Comments

Popular posts from this blog

Alert Dialogs in android apps

Source code of Media Player App

WebView in android apps