CS101_E_Quiz_3
CS101_E_Quiz_3
#include <iostream>
using namespace std;
int main()
{ int a;
a = 5 + 3 * 5;
cout << a;
return 0;
}
a) 35
b) 20
c) 25
d) 30
2- What is this operator called?:?
a) Conditional
b) Relational
c) Casting operator
d) None of the mentioned
#include<iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a / b);
}
int main ()
{
int x = 5, y = 2;
float n = 5.0, m = 2.0;
cout << operate (x, y);
cout << operate (n, m);
return 0;
}
4- If the variable count exceeds 100, a single statement that prints “Too many” is
a) if (count<100) cout << “Too many”;
b) if (count>100) cout >> “Too many”;
c) if (count>100) cout << “Too many”;
d) None of these.
a) 22
b) 37
c) 7
d) Error. Cannot be executed
int main()
{
int new = -10;
cout<<"new is: "<<new;
return 0;
}
a) new is: -10
b) new is: 10
c) Compilation Error
d) new is: 0
a) postfix
b) unary
c) shift
d) equality
a) 4
b) 2
c) 3
d) 1
Name: ____________________ Reg. No: _______________
int main()
{
int i = 0, x = 0;
do
{
if(i % 5 == 0)
{
cout<<x;
x++;
}
++i;
}while(i<10);
cout<<x;
return 0;
}
a) 01
b) 012
c) 0
d) 0123
#include <iostream>
using namespace std;
void mani()
void mani()
{
cout<<"hai";
}
int main()
{
mani();
return 0;
}
a) hai
b) haihai
c) compile time error
d) run time error
Name: ____________________ Reg. No: _______________
#include <iostream>
using namespace std;
void fun(int x, int y)
{
x = 20;
y = 10;
}
int main()
{
int x = 10;
fun(x, x);
cout<< x;
return 0;}
a) 10
b) 20
c) compile time error
d) none of the mentioned
#include <iostream>
using namespace std;
int main ()
{
int x, y;
x = 5;
y = ++x * ++x;
cout<< x << y;
x = 5;
y = x++ * ++x;
cout<< x << y;
return 0;
}
a) 749736
b) 736749
c) 367497
d) none of the mentioned
Name: ____________________ Reg. No: _______________
#include <iostream>
using namespace std;
int main()
{
int i, j;
j = 10;
i = ( j++, j + 100, 999 + j);
cout<<i;
return 0;
}
a) 1000
b) 11
c) 1010
d) 1001
int main()
{
int i=0,x=0;
for(i=1;i<10;i*=2)
{
x++;
cout<<x;
}
cout<<x;
return 0;
}
a) 1234567899
b) 12345678910
c) 123455
d) 12344
16- Assigning one or more function body to the same name is called
a) Function Overriding
b) Function Overloading
c) Both a and b
d) Function Overlapping
int main()
{
if(0)
{
cout<<"Hi";
}
else
{
cout<<"Bye";
}
return 0;
}
a) Hi
b) Bye
c) HiBye
d) Compilation Error
int main()
{
int A=50, B=20;
cout<<A<<B<<"--";
Execute(A,B);
cout<<A<<B<<"--";
return 0;
}
a) 5020--5020-- b) 5020--7012020--12020--
c) 5020--70120200—5020 d) 5020--7050200--5020—
Name: ____________________ Reg. No: _______________
#include <iostream>
#include <string>
using namespace std;
string askNumber(string str = "Please enter a number: ");
int main()
{
string number = askNumber();
cout << "Here is your number: " << number;
return 0;
}
string askNumber(string str)
{
string number;
cout << str;
cin >> number;
return number;
}
a) 5
b) 6
c) the number you entered
d) compile time error