CPP

CPP

User Defined Types has 10 Questions

Which keyword is used to define the user defined data types?

def
union
typedef
type
Identify the correct statement.

typedef does not create different types.It only creates synonyms of existing types.
typedef create different types.
both a & b
none of the mentioned
What does the data type defined by union will do ?

It allow one different portion of memory to be accessed as same data types
It allow one same portion of memory to be accessed as same data types
It allow one different portion of memory to be accessed as different data types
It allow one same portion of memory to be accessed as different data types
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         typedef int num;
  6.         num a = 10, b = 15;
  7.         num c = a + b + a - b;
  8.         cout << c;
  9.         return 0;
  10.     }

20
15
30
25
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         int i;
  6.         enum month {
  7.             JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,DEC
  8.         };
  9.         for (i = JAN; i <= DEC; i++)
  10.             cout << i;
  11.         return 0;
  12.     }

012345678910
0123456789
01234567891011
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         typedef int num;
  6.         typedef char let;
  7.         let w = "steve";
  8.         num a = 10, b = 15;
  9.         num c = a + w;
  10.         cout << c;
  11.         return 0;
  12.     }

10steve
steve10
compile time error
compile but not run
What is the syntax of user-defined data types?

typedef_existing data type_new name
typedef_new name_existing data type
def_existing data type_new name
none of the mentioned
How many types of user-defined data type are in c++?

1
2
3
4
What is the scope of typedef defined data types?

inside that block only
whole program
outside the program
none of the mentioned
How many types of models are available to create the user-defined data type?

1
2
3
4