Classes And Objects In C Plus Plus - Study Mode

[#191] What will be the output of the following C++ code? #include <iostream>
using namespace std
int main()
{
int a, b
int* c
c = &a
a = 200
b = 200
*c = 100
b = *c
cout << *c << " " << b
return 0
}
Correct Answer

(D) 100 100

[#192] What will be the output of the following C++ code? #include <iostream>
#include <string>
using namespace std
class A
{
static int a
public:
void change(int i){
a = i
}
void value_of_a(){
cout<<a
}
}
int main(int argc, char const *argv[])
{
A a1 = A()
a1.change(5)
a1.value_of_a()
return 0
}
Correct Answer

(C) Error

[#193] What will be the output of the following C++ code if the string entered by the user is "Hello World"? #include <iostream>
#include <string>
using namespace std
int main(int argc, char const *argv[])
{
string str
cin>>str
cout<<str
return 0
}
Correct Answer

(B) Hello

[#194] What will be the output of the following C++ code? #include <iostream>
using namespace std
int main()
{
double a = 21.09399
float b = 10.20
int c
c = (int) a
cout << c
c = (int) b
cout << c
return 0
}
Correct Answer

(A) 2110

[#195] What will be the output of the following C++ code? #include <iostream>
#include <string>
using namespace std
int main ()
{
string str ("microsoft")
string::reverse_iterator r
for (r = str.rbegin()
r < str.rend()
r++ )
cout << *r
return 0
}
Correct Answer

(C) tfosorcim