LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C Programming
  • Structures
  • Unions And Enumerations

C Programming > Structures

UNIONS AND ENUMERATIONS MCQs

Total Questions : 72

Page 1 of 8 pages
Question 1.


If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide
then will the following structure always occupy 7 bytes?



struct ex

{

char ch;

int i;

long int a;

};



  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

A compiler may leave holes in structures by padding the first char in the structure with another 

byte just to ensures that the integer that follows is stored at an location. Also, there might be 

2extra bytes after the integer to ensure that the long integer is stored at an address, which is 

multiple of 4. Such alignment is done by machines to improve the efficiency of accessing values.

Question 2.

Can a structure can point to itself?


  1.    Yes
  2.    No
 Discuss Question
Answer is Option A. -> Yes

A structure pointing to itself is called self-referential structures.
Question 3.


Will the following declaration work?



typedef struct s

{

int a;

float b;

}s;

  1.    Yes
  2.    No
 Discuss Question
Answer is Option A. -> Yes

No answer description available for this question. 

Question 4.

Can we have an array of bit fields?


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

No answer description available for this question. 

Question 5.

Is it necessary that the size of all elements in a union should be same?


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

No answer description available for this question. 

Question 6.

By default structure variable will be of auto storage class


  1.    Yes
  2.    No
 Discuss Question
Answer is Option A. -> Yes

No answer description available for this question. 

Question 7.

The elements of union are always accessed using & operator


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

No answer description available for this question. 

Question 8.

A pointer union CANNOT be created


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

No answer description available for this question. 

Question 9.

Is there easy way to print enumeration values symbolically?


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

You can write a function of your own to map an enumeration constant to a string.

Question 10.


Will the following code work?



#include<stdio.h>
#include<malloc.h>

struct emp
{
int len;
char name[1];
};
int main()
{
char newname[] = "Rahul";
struct emp *p = (struct emp *) malloc(sizeof(struct emp) -1 +
strlen(newname)+1);

p->len = strlen(newname);
strcpy(p -> name, newname);
printf("%d %s\n", p->len, p->name);
return 0;
}

  1.    Yes
  2.    No
 Discuss Question
Answer is Option A. -> Yes

The program allocates space for the structure with the size adjusted so that the 

name field can hold the requested name.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • Next →
  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Unions And Enumerations

Topics

  • Computer Aptitude
  • SAIL Junior Officer (E-0)
  • 10th Grade
  • 11th Grade
  • 12th Grade
  • 4th Grade
  • 5th Grade
  • 6th Grade
  • 7th Grade
  • 8th Grade
  • 9th Grade
  • NCERT
  • Cat
  • Commerce
  • Computer Science
  • Engineering
  • English
  • General Knowledge
  • Ias
  • Management
  • Quantitative Aptitude
  • Reasoning Aptitude
  • General Studies (Finance And Economics)
  • Analytical Instrumentation
  • Biochemistry
  • Bioinformatics
  • Biology
  • Biotechnology
  • Bitsat
  • Business Statistics
  • C Programming
  • C++ Programming
  • Cell Biology
  • Chemistry
  • Cost Accounting
  • Drug And Pharmaceutical Biotechnology
  • Electrical Measurement And Instrumentation
  • Environment Management
  • Environmental Biotechnology
  • Enzyme Technology
  • Financial Management And Financial Markets
  • Gate
  • General Science
  • Geography
  • Heat Transfer
  • History And National Movements
  • Human Anatomy And Physiology
  • Human And Cultural Diversity
  • Human Resource Management
  • Indian Economy
  • Indian Geography
  • Indian History
  • Indian Polity
  • Instrumentation Transducers
  • International Relations
  • Life Sciences
  • Marketing And Marketing Management
  • Mass Transfer
  • Mechanics Of Materials
  • Microbiology
  • Neet
  • Professional Communication
  • Renewable Energy
  • Sociology
  • Surveying
  • Total Quality Management
  • Uidai Aadhaar Supervisor Certification
  • Virology

Recent Questions

Q.    _________ Is The Connective Tissue Beneath the Sk....

Q.   Positive Integers Indicated By X And Y Satisfy 3 1/x * Y 2/....

Q.   The Knocking Tendency In Compression Ignition Engines For A ....

Q.   In __________verb The Action Passes From The Subject An Obje....

Q.   Pre-cooling Is Required Before Passing The Vapour To The Con....

Q.   Ctrl + I Is Used To

Q.   Q. Consider The Following Items: Prison Trade And Co....

Q.   Who Is Paul A. Volcker ?

Q.   If H₁ = Inner Film Co-efficient And /h₂ = Outer Film Co-....

Q.   Which One Is True About Bacteria

Q.   Who Was The 1st President Of BCCI ( Board Of Control For Cri....

Q.   A Combinational Logic Circuit Which Generates Particular Bin....

Q.   Assertion A : To Estimate The Rainfall Over A Catchment, The....

Q.   A....

Q.   The Department Of Atomic Energy Was Established In

Q.   In Figure, The Current I

Q.   A Bar Of Square Section Of Area A² Is Held Such That It....

Q.   Vane Anemometer

Q.   When Low Carbon Steel Is Heated Up To Upper Critical Tempera....

Q.   Metacentric Height Is Given As The Distance Between

LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • YouTube Channel
  • Maths Fast Trick
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password