Sail E0 Webinar

MCQs

Total Questions : 8
Question 1. The correct syntax to use typedef for struct is.
  1.    typedef struct temp {      
  2.    typedef struct {      int a; }TEMP;
  3.    struct temp {      int a; }; typedef struct temp TEMP;
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned


None.


Question 2. Which of the following is FALSE about typedef?
  1.    typedef follow scope rules
  2.    typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)
  3.    You cannot typedef a typedef with other term.
  4.    All of the mentioned
 Discuss Question
Answer: Option B. -> typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)


None


Question 3. typedef which of the following may create problem in the program?
  1.    ;
  2.    printf/scanf
  3.    Arithmetic operators
  4.    All of the mentioned.
 Discuss Question
Answer: Option D. -> All of the mentioned.


None.


Question 4. For the following expression to work, which option should be selected.     
string p = "HELLO;
  1.    typedef char [] string;
  2.    typedef char * string;
  3.    Both (a) and (b)
  4.    Such expression cannot be generated in C
 Discuss Question
Answer: Option B. -> typedef char * string;


None.


Question 5. Which of the given option is the correct method for initialization?      
typedef char *string;
  1.    *string *p = Hello";
  2.    string p = Hello";
  3.    *string p = 'A';
  4.    Not more than one space should be given when using typedef
 Discuss Question
Answer: Option B. -> string p = Hello";


None.


Question 6. typedef int (*PFI)(char *, char *)creates:
  1.    type PFI, for pointer to function (of two char * arguments) returning int
  2.    Error
  3.    type PFI, function (of two char * arguments) returning int
  4.    type PFI, for pointer
 Discuss Question
Answer: Option A. -> type PFI, for pointer to function (of two char * arguments) returning int


None.


Question 7. What is the output of this C code?
typedef struct p
{
int x, y;
}k;
int main()
{
struct p p = {1, 2};
k k1 = p;
printf("%d\n", k1.x);
}
  1.    Compile time error
  2.    1
  3.    0
  4.    Depends on the standard
 Discuss Question
Answer: Option B. -> 1


None.


Question 8. typedef declaration:
  1.    Does not create a new type
  2.    It merely adds a new name for some existing type.
  3.    Both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Both a & b


None.


Latest Videos

Latest Test Papers