Programming for Problem Solving (3110003) MCQs

MCQs of Structure

Showing 1 to 10 out of 17 Questions
1.
Structure can contain elements of the different data type
(a) True
(b) False
Answer:

Option (a)

2.
Which of the following operator is used to select a member of a structure variable
(a) .(dot)
(b) ,(comma)
(c) : (colon)
(d) ;(semicolon)
Answer:

Option (a)

3.
Structure can contain elements of the same data type.
(a) True
(b) False
Answer:

Option (a)

4.
What is a structure in C language?
(a) A structure is a collection of elements that can be of the same data type.
(b) A structure is a collection of elements that can be of the different data type.
(c) Elements of a structure are called members.
(d) All of these
Answer:

Option (d)

5.
What is the size of a C structure?
(a) C structure is always 128 bytes.
(b) Size of C structure is the total bytes of all elements of structure.
(c) Size of C structure is the size of largest element.
(d) None of these
Answer:

Option (b)

6.

What will be the size of the following structure? (Consider integer occupies – 4 bytes)

struct temp
{
     int a[10];
     char p;
};

(a)

5

(b)

11

(c)

41

(d)

44

Answer:

Option (c)

7.
Which of the following cannot be a structure member?
(a) Another structure
(b) Array
(c) Function
(d) None of these
Answer:

Option (c)

8.
What is the output?

struct student
{
    int no;
    char name[20];
};
void main()
{
    struct student s;
    s.no = 8;
    printf("%d",s.no);
}

(a) 8
(b) Compiler error
(c) Blank
(d) Runtime error
Answer:

Option (a)

9.
What is the output?

struct student
{
    int no = 5;
    char name[20];
};
void main()
{
    struct student s;
    s.no = 8;
    printf("%d",s.no);
}

(a) 8
(b) Compiler error
(c) 5
(d) Runtime error
Answer:

Option (b)

10.
What is the output?

struct student
{
    int no;
    char name[20];
};
void main()
{
    student s;
    s.no = 8;
    printf("%d",s.no);
}

(a) 8
(b) Compiler error
(c) Blank
(d) Runtime error
Answer:

Option (b)

Showing 1 to 10 out of 17 Questions