Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

shoba


{ City } chennai
< Country > india
* Profession * hr
User No # 125360
Total Questions Posted # 17
Total Answers Posted # 19

Total Answers Posted for My Questions # 19
Total Views for My Questions # 1692

Users Marked my Answers as Correct # 0
Users Marked my Answers as Wrong # 0
Questions / { shoba }
Questions Answers Category Views Company eMail

Write a C++ Program to Display Number (Entered by the User).

1 Software 52

Identify the error in the following program. #include void main() { int i = 0; i = i + 1; cout « i « " "; /*comment *//i = i + 1; cout << i; }

1 Software 62

Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69

2 Software 84

Write a C++ Program to find Square Root of a number using sqrt() function.

1 C++ General 116

Write a C++ Program to Find Sum and Average of three numbers.

1 Software 56

Write a program to read two numbers from the keyboard and display the larger value on the screen

1 Software 51

Write a C++ Program to Find whether given Number is Odd or Even.

1 C++ General 107

Write a C++ Program to Reverse a Number using while loop.

1 C++ General 101

Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.

1 C++ General 155

Write a C++ Program to Find Sum and Average of n numbers using for loop.

1 C++ General 110

Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70

1 Software 55

Identify the error in the following program. include using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }

1 C++ General 109

Identify the errors in the following program. #include using namespace std; void main() { int i=5; while(i) { switch(i) { default: case 4: case 5: break; case 1: continue; case 2: case 3: break; } i-; } }

1 C++ General 210

Write a C++ Program to Check Whether a character is Vowel or Consonant.

2 Software 74

Write a C++ Program to find Addition of Two Numbers.

1 Software 50


 [1]   2    Next



Answers / { shoba }

Question { 52 }

Write a C++ Program to Display Number (Entered by the User).


Answer

Solution:
/* C++ Program to Display Number (Entered by the User) */
#include
using namespace std;
int main()
{
int number;
cout << "Enter an integer :: ";
cin >> number;
cout << "
The Number entered is :: " << number<<"
";
return 0;
}
Output:
/* C++ Program to Display Number (Entered by the User) */
Enter an integer :: 8
The Number entered is :: 8
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 62 }

Identify the error in the following program.
#include
void main()
{
int i = 0;
i = i + 1;
cout « i « " ";
/*comment *//i = i + 1;
cout << i;
}


Answer

/* comment*//i=i+1; -> Syntax error

Is This Answer Correct ?    0 Yes 0 No


Question { 84 }

Write a program to display the following output using a single cout statement
Maths=90
Physics=77
Chemistry = 69


Answer

#include
#include
using namespace std;
int main()
{

char *sub[]={"Maths","Physics","Chemestry"};
int mark[]={90,77,69};
for(int i=0;i<3;i++)
{
cout< }
return 0;
}
Output:
Maths=90
Physics=77
Chemistry=69

Is This Answer Correct ?    0 Yes 0 No

Question { 84 }

Write a program to display the following output using a single cout statement
Maths=90
Physics=77
Chemistry = 69


Answer

#include
#include
using namespace std;
int main()
{

char *sub[]={"Maths","Physics","Chemestry"};
int mark[]={90,77,69};
for(int i=0;i<3;i++)
{
cout< }
return 0;
}
Output:
Maths=90
Physics=77
Chemistry=69

Is This Answer Correct ?    0 Yes 0 No

Question { 116 }

Write a C++ Program to find Square Root of a number using sqrt() function.


Answer

Solution:
/* C++ Program to find Square Root of a number using sqrt() function */
#include
#include
using namespace std;
int main()
{
float sq,n;
cout<<"Enter any positive number :: ";
cin>>n;
sq=sqrt(n);
cout<<"
Square root of Entered Number [ "< ";
return 0;
}
Output:
/* C++ Program to find SquareRoot of a number using sqrt() function */
Enter any positive number :: 10000
Square root of Entered Number [ 10000 ] is :: 100
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 56 }

Write a C++ Program to Find Sum and Average of three numbers.


Answer

Soluion:
/* C++ Program to Find Sum and Average of three numbers */
#include
using namespace std;
int main()
{
float a,b,c,sum,avg;
cout<<"Enter 1st number :: ";
cin>>a;
cout<<"
Enter 2nd number :: ";
cin>>b;
cout<<"
Enter 3rd number :: ";
cin>>c;
sum=a+b+c;
avg=sum/3;
cout<<"
The SUM of 3 Numbers [ "< ";
cout<<"
The AVERAGE of 3 Numbers [ "< ";
return 0;
}
Output:
/* C++ Program to Find Sum and Average of three numbers */
Enter 1st number :: 3
Enter 2nd number :: 4
Enter 3rd number :: 5
The SUM of 3 Numbers [ 3 + 4 + 5 ] = 12
The AVERAGE of 3 Numbers [ 3, 4, 5 ] = 4
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 51 }

Write a program to read two numbers from the keyboard and display the larger value on the screen


Answer

#include
#include
using namespace std;
int main()
{
float a,b;
cout<<" Enter two values :"< cin>>a>>b;
if(a>b)
cout<<" larger value = "< else
cout<<" larger value = "< return 0;
}
OUTPUT:
Enter two values:10 20
Larger value:20

Is This Answer Correct ?    0 Yes 0 No

Question { 107 }

Write a C++ Program to Find whether given Number is Odd or Even.


Answer

Solution:
/* C++ Program to Find whether given Number is Odd or Even */
#include
using namespace std;
int main()
{
int a;
cout<<"Enter any positive number :: ";
cin>>a;
if(a%2==0)
{
cout<<"
The Entered Number [ "< ";
}
else
{
cout<<"
The Entered Number [ "< ";
}
return 0;
}
Output:
/* C++ Program to Find whether given Number is Odd or Even */
Enter any positive number :: 1327
The Entered Number [ 1327 ] is ODD Number.
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 101 }

Write a C++ Program to Reverse a Number using while loop.


Answer

Solution:
/* C++ Program to Reverse a Number using while loop */
#include
using namespace std;
int main()
{
int no,rev=0,r,n;
cout<<"Enter any positive number :: ";
cin>>n;
no=n;
while(no>0)
{
r=no%10;
rev=rev*10+r;
no=no/10;
}
cout<<"
Reverse of a Number [ "< ";
return 0;
}
Output:
/* C++ Program to Reverse a Number using while loop */
Enter any positive number :: 123456
Reverse of a Number [ 123456 ] is :: [ 654321 ]
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 155 }

Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.


Answer

#include
#include
using namespace std;
int main()
{
int n;
char *str;
str="WELL DONE";
cout<<" Enter an integer value ";
cin>>n;
for(int i=0;i {
cout< }
return 0;
}
OUTPUT:
Enter an integer value 5
WELL DONE
WELL DONE
WELL DONE
WELL DONE
WELL DONE

Is This Answer Correct ?    0 Yes 0 No

Question { 110 }

Write a C++ Program to Find Sum and Average of n numbers using for loop.


Answer

Solution:
/* C++ Program to Find Sum and Average of n numbers using for loop */
#include
using namespace std;
int main()
{
int i,n,x,sum=0;
float avg;
cout<<"How many numbers u want to enter :: ";
cin>>n;
for(i=1;i<=n;++i)
{
cout<<"
Enter number "< cin>>x;
sum+=x;
}
avg=(float)sum/(float)n;
cout<<"

Sum of "< cout<<"

Average of "< cout<<"
";
return 0;
}
Output:
/* C++ Program to Find Sum and Average of n numbers using for loop */
How many numbers u want to enter :: 6
Enter number 1 :: 1
Enter number 2 :: 2
Enter number 3 :: 3
Enter number 4 :: 4
Enter number 5 :: 5
Enter number 6 :: 6
Sum of 6 Numbers :: 21
Average of 6 Numbers :: 3.5
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Question { 55 }

Write a program to read the values a, b and c and display x, where
x=a/b–c.
Test the program for the following values:
(a) a = 250, b = 85, c = 25
(b) a = 300, b = 70, c = 70


Answer

#include
#include
using namespace std;
int main()
{
float a,b,c,x;
cout<<" Enter the value of a,b, &c :"< cin>>a>>b>>c;
if((b-c)!=0)
{
x=a/(b-c);
cout<<" x=a/(b-c) = "< }
else
{
cout<<" x= infinity "< }
return 0;
}
OUTPUT:
Enter the value of a,b,&c:300 70 70
X=infinity

Is This Answer Correct ?    0 Yes 0 No

Question { 109 }

Identify the error in the following program.
include
using namespace std;
void main()
{
int num[]={1,2,3,4,5,6};
num[1]==[1]num ? cout<<"Success" : cout<<"Error";
}


Answer

num [1] = [1] num?. You should write index number after array name but here index number is mention before array name in [1] num
So expression syntax error will be shown.
Correction : num[1] = num[1]? is the correct format.

Is This Answer Correct ?    0 Yes 0 No

Question { 210 }

Identify the errors in the following program.
#include
using namespace std;
void main()
{
int i=5;
while(i)
{
switch(i)
{
default:
case 4:
case 5:
break;
case 1:
continue;
case 2:
case 3:
break;
}
i-;
}
}


Answer

case 1 :
continue;
The above code will cause the following situation:
Program will be continuing while value of i is 1 and value of i is updating. So infinite loop will be created.
Correction: At last line i- should be changed as i–;

Is This Answer Correct ?    0 Yes 0 No

Question { 74 }

Write a C++ Program to Check Whether a character is Vowel or Consonant.


Answer

Solution:
/* C++ Program to Check Whether a character is Vowel or Consonant */
#include
using namespace std;
int main()
{
char c;
int isLowercaseVowel, isUppercaseVowel;
cout << "Enter any character to check :: ";
cin >> c;
// evaluates to 1 (true) if c is a lowercase vowel
isLowercaseVowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
// evaluates to 1 (true) if c is an uppercase vowel
isUppercaseVowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
// evaluates to 1 (true) if either isLowercaseVowel or isUppercaseVowel is true
if (isLowercaseVowel || isUppercaseVowel)
{
cout<<"
The Entered Character [ "< ";
}
else
{
cout<<"
The Entered Character [ "< ";
}
return 0;
}
Output:
/* C++ Program to Check Whether a character is Vowel or Consonant */
Enter any character to check :: u
The Entered Character [ u ] is a Vowel.
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

 [1]   2    Next