C Programming MCQ - Structure & Union

1:  

Consider the declaration:
static struct
         {    unsigned a:5;
              unsigned b:5;
              unsigned c:5;
            unsigned d:5%:
             }v=(1,2,3,4);

v occupies

A.

4 bytes

B.

2 bytes

C.

1 byte

D.

None of these

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



2:  

A short integer occupies 2 bytes an, ordinary integer 4 bytes and a long integer occupies 8 bytes of memory
If a structure is defined as
struct TAB{
short a;
int b;
long c;
}TABLE[10];

the the total memory requirement for TABLE is

A.

14

B.

140

C.

40

D.

32

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

sonali manohar shelke said: (8:56am on Monday 18th December 2017)
a is short which occupies 2 bytes per element so there are 10 elements which equal to 20 bytes for ab is int which contains 4 bytes per element so again they alson contain 10 elements which is equal to 40 bytesand c is long which occupies 80 bytes for 10 elements' 80 total memory space occupied is 20 40 80=140so option B is correct

Write your comments here:



3:  

The expression a<<6 shifts all bits of a six places to the left. If a 0x6db7, then what is the value of a<<6?

A.

0xa72b

B.

0xa3b

C.

0x6dc0

D.

0x1111

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



4:  

The declaration
union id{
char color[12];
int size;}shirt,Jeans;

denotes shirt and Jeans are variable of type id and

A.

Each can have a value of color and size

B.

Each can represent either a 12-character color or an integer size at a time

C.

Shirt and Jeans are same as struct variables

D.

Variable shirt and Jeans cannot be used simultaneously in a statement

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



5:   Most appropriate sentence to describe unions is
A. Union are like structures
B. Union contain members of different data types which share the same storage area in memory
C. Union are less frequently used in program
D. Union are used for set operations
 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:




Syllabus Covered in this section is

  • Elements of C-Tokens
  • Identifiers
  • data types in C
  • Control structures in, C
  •  Sequence, selection and iteration(s).
  • Structured data types in C
  • Arrays, Structures, union, String, and pointers
  • Functions, Recursion
  • Parameter passing, Scope
  •  Binding, Abstract data types

This Section covers Multiple Choice Questions Answers in C Programming . Here questions answers are given with explanation and references. These questions can be used for the preparation of various competitive and academic exams.

Who can benefit - 

  • Any undergraduate or postgraduate student who is seeking C Programming objective type questions answers can use this section.
  • C programming Multiple Choice questions Answers can help you in interview preparation.
  • C Programming Objective type Questions Answers are also used at SSC and HSc level for Exam preparation.
  • C Programming MCQ Questions Answers are also used by engineering students in the preparation of their Exams.
  • Any candidate who has to appear for DOEACC A, B or C level Exam can also learn C Programming Questions Answers.
  • All the teachers who are appearing for Kendriya Vidyalya Sangathan Entrance Exam can also use C Programming Multiple Choice Questions Answers.
  • C Programming MCQs can also be used by the students who are pursuing B.Sc or Msc Computer Science.
  • C Programming Questions Answers can also be used by BCA students for the preparation of their exams.
  • Any student who is pursuing B.Sc. in Information Technology can also use this C Programming mcq Questions Answers.
  •  MCA students can also prepare for their exams using  C Programming Objective Type Questions Answers.
  • You can get free access to C Programming mcq pdf.
  • You can also have online access to C Programming Questions Answers EBook.

Various Search Terms used for this section are

  • C Programming quiz questions with answers

  • C Programming exam questions answers

  • C Programming MCQ questions Answers

  • C Programming MCQ

  • C Programming Questions Answers