Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. The correct syntax to use typedef for struct is.

  1. a) typedef struct temp
  2.     {
  3.         int a;
  4.     }TEMP;
  5. b) typedef struct
  6.     {
  7.         int a;
  8.      }TEMP;
  9. c) struct temp
  10.     {
  11.         int a;
  12.     };
  13.     typedef struct temp TEMP;
  14. d) All of the mentioned

View Answer

Answer: d [Reason:] None.

2. For the following expression to work, which option should be selected.
    string p = “HELLO”;
a) typedef char [] string;
b) typedef char *string;
c) typedef char [] string; and typedef char *string;
d) Such expression cannot be generated in C

View Answer

Answer: b [Reason:] None.

3. Which of the given option is the correct method for initialization?
    typedef char *string;
a) *string *p = “Hello”;
b) string p = “Hello”;
c) *string p = ‘A’;
d) Not more than one space should be given when using typedef

View Answer

Answer: b [Reason:] None.

4. Which of the following is FALSE about typedef?
a) typedef follow scope rules
b) typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)
c) You cannot typedef a typedef with other term.
d) All of the mentioned

View Answer

Answer: b [Reason:] None.

5. typedef which of the following may create problem in the program
a) ;
b) printf/scanf
c) Arithmetic operators
d) All of the mentioned

View Answer

Answer: d [Reason:] None.

6. typedef int (*PFI)(char *, char *)creates
a) type PFI, for pointer to function (of two char * arguments) returning int
b) Error
c) type PFI, function (of two char * arguments) returning int
d) type PFI, for pointer

View Answer

Answer: a [Reason:] None.

7. typedef declaration
a) Does not create a new type
b) It merely adds a new name for some existing type
c) Does not create a new type, It merely adds a new name for some existing type
d) None of the mentioned

View Answer

Answer: c [Reason:] None.

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct student
  3.     {
  4.         char *a;
  5.     }stu;
  6.     void main()
  7.     {
  8.         stu s;
  9.         s.a = "hi";
  10.         printf("%s", s.a);
  11.     }s

a) Compile time error
b) Varies
c) hi
d) h

View Answer

Answer: a [Reason:] None.