What will be the output of following code fragment?
a=60;
b=70;
i=j=10;
if(a<100){
if(b>50){
++i ;
else
++j ;
}}
cout<< i+j;
21
19
20
None of the above
Answer: Option A.
What is the error in the code?"
Char ch;
Int vowels=0,others=0;
Cin>> ch;
While((ch>= ‘A’ && ch <+ ‘Z’) || (ch>=’a’ && ch <= ‘z’)){
Switch(ch)
{
Case’a’:
Case’A’:
Case’e’:
Case’E’:
Case’i’:
Case’i’:
Case’o’:
Case’O’:
Case’u’:
Case’U’: ++vowels;
Break;
Default: ++others;
}}
Cout<< vowels<< ‘\n’<< others;
The while loop is an endless loop. Whatever value of ch has in the beginning, will remain the same, as ch is not updated within the loop.
There is no need to declare 'a' and 'A' and hence all other vowels gain in switch as it is case insensitive.
The switch statement’s two case constants are identical case 'i' and 'i' which is an error
More than one is correct from above.
Answer: Option D.
Which of the following is not supported by Java?
Operator overloading
Multiple inheritances for classes
None of these
Both (a) and (b)
Answer: Option D.
Which of the following are included in relational integrity constraints in DBMS?
Key constraints
Domain constraints
Referential integrity constraints
All of these
Answer: Option D.
What is the output of the following program?
#include
int g =20;
void func(int &x, int y)
{
x=x-y ; y=x*10 ;
cout<< x<<’,’<< y<< ‘\n’ }
void main()
{ int g=7 ;
func(g,::g);
cout<< g<< ‘,’ << :: g ;
}