Basic Syntax
- What is the use of the function “showbase”?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Indicate the base used
- What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
unsigned long num = 56;
cout << num << oct <<" " << num << endl;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In this program, We are finding the octal number of given number by using oct function.
- What is the output of this program?
#include <iostream>
#include <iomanip>
using namespace std;
void showDate(int mm, int dd, int yy)
{
cout << setfill('0');
cout << setw(2) << mm << '/'
<< setw(2) << dd << '/'
<< setw(4) << yy << endl;
}
int main()
{
showDate(1, 1, 2019);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In this program, We are using the setw function to print the date in correct format.
- Which function allows you to set minimum width for the next input?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
setw function of iomanip header file allows you to set minimum width for the next input.
- Choose the correct formatted code.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The braces that tell where a function begins and ends should be aligned with the function name and be on their own lines.