Identify the size of the 'hello' structure in bytes.
What is used to access a function from one source file in another?
What type of error is caused when you divide any variable by 0?
What are the mandatory parts in a function declaration?
What will be the data type of the result of the following operation?
(float)a * (int)b / (long)c * (double)d
When a double value is converted to a float, what happens to the value?
In the given code, what will be the value of a variable x?
#include<stdio.h>
int main()
{
int y = 100;
const int x = y;
printf("%d\n", x);
return 0;
}
#include<iostream>
using namespace std;
class Demo
{
public:
void showMessage()
{
cout << "Inside showMessage() Function" << endl;
}
};
int main()
{
const Demo d1;
d1.showMessage();
return 0;
}
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
struct Time
{
int hours;
int minutes;
int seconds;
};
int toSeconds(Time now);
int main()
{
Time t;
t.hours = 5;
t.minutes = 30;
t.seconds = 45;
cout << "Total seconds: " << toSeconds(t) << endl;
return 0;
}
int toSeconds(Time now)
{
return 3600 * now.hours + 60 * now.minutes + now.seconds;
}
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool mygreater(int i, int j)
{
return (i > j);
}
int main()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
vector<int> v(myints, myints + 8);
pair<vector<int>::iterator, vector<int>::iterator> bounds;
sort(v.begin(), v.end());
bounds = equal_range(v.begin(), v.end(), 20);
cout << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n';
return 0;
}