Data Structures
- What is the output of this program?
#include
#include
using namespace std;
int main()
{
struct Employee
{
int id;
char name[20];
};
Employee emp;
emp.id = 101;
strcpy(emp.name, "Ajit Kumar Gupta");
cout << emp.id << endl;
cout << emp.name << endl;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
We are copying the value john to the name and then we are printing the values that are in the program.
- The declaration of the structure is also called as?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The structure declaration with open and close braces and with a semicolon is also called structure specifier.
- What will happen when the structure is declared?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
While the structure is declared, it will not be initialized, So it will not allocate any memory.
- What will be used when terminating a structure?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
While terminating a structure, a semicolon is used to end this up.
- The data elements in the structure are also known as what?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
members