CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Interview Success Kit - Get Success in Job Interviews Interview Success Kit - 30,000 Interview Que. & Ans.
Covers 30,000+ Interview Questions asked in actual MNC Interviews - all with model answers.

Sponsored Links

Interview Questions
Our Services

INTERVIEW QUESTIONS PROGRAMMING LANGUAGES C DETAILS
Question :
What are enumerations?

Posted by: SWAMINATHAN on 3/13/2013

Contact SWAMINATHAN Contact SWAMINATHAN
Category C Interview Questions
Rating (3.5) By 52 users
Added on 3/13/2013
Views 725
Rate it!


Answers:

Source: CoolInterview.com

enumerations is one type of user defined data type
Source: CoolInterview.com



Posted by: sekhar

Contact sekhar Contact sekhar

Source: CoolInterview.com

Enums are group of symbolic constant each having some integer value.

enum(PASS_MARK=60,MERIT_MARK=70)

defines two symbolic constant PASS_MARK and MERIT_MARK as 60 and 70,- it could be done with #define as well.

However without specific values ,- the values are assigned automatically ,- starting with 0 for the first element and 1 for the second, 3 for the second etc.

In case if we state a number for the first element then it will increment the value of each consecutive elemts with '1'.

enum(MON=1,TUE,WED,THU,FRI,SAT,SUN);

gives the values of 1-7 to the names of days.
Source: CoolInterview.com



Posted by: Andrew Gecse

Contact Andrew Gecse Contact Andrew Gecse

Source: CoolInterview.com

enumerations can be used in place of a macros for example let us consider an example where a function is failing for many reasons like array out of bounds, divide by zero ,and memory allocation failure
when you call such a function and if something goes wrong you may not know for what reason exactly in that case you can make an enum like
enum error
{
ARRAY_OUT =0,
MEMORY_FAIL,
DIVIDE_ZERO
}
and so on instead of defining each one by macro
Then based on return value it would be easy to locate eror . And ofcourse it is a user defined type.The values assigned will be from 0 to the number of elements present . you can also assign different values in between like
enum week {
sunday, monday, tuesday=4,wednesday,thursaday}
then wednesday and thursday would have a value of 5 and 6


Source: CoolInterview.com



Posted by: shwetavg

Contact shwetavg Contact shwetavg

Source: CoolInterview.com

Enums are group of symbolic constant each having some integer value.

enum(PASS_MARK=60,MERIT_MARK=70)

defines two symbolic constant PASS_MARK and MERIT_MARK as 60 and 70,- it could be done with #define as well.

However without specific values ,- the values are assigned automatically ,- starting with 0 for the first element and 1 for the second, 3 for the second etc.

In case if we state a number for the first element then it will increment the value of each consecutive elemts with '1'.

enum(MON=1,TUE,WED,THU,FRI,SAT,SUN);

gives the values of 1-7 to the names of days.
Source: CoolInterview.com



Posted by: ranjith

Contact ranjith Contact ranjith

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification Enter the above shown code: *
    Inform me about updated answers to this question

    Related Questions
    View Answer
    Write down the equivalent pointer expression for reffering the same element a[i][j][k][l]?
    View Answer
    What is the use of typedef?
    View Answer
    Which mistakes are called as token error?
    View Answer
    What is the function of % using in formatted string.
    View Answer
    How to print the names of employees or students in alphabetical order using C programming?
    View Answer
    How should i rate on the basis of the basis of the scenario the insertion sort , bubble sort , Quick Sort?
    View Answer
    Can we print values from 1 to 100 without using for,while,do-while,if etc.?answer should be logical.
    View Answer
    How to write a program to print its own source code?
    View Answer
    What are the advantages of pointers,give me programs containing variables and pointer variables?
    View Answer
    I want source code of series of prime numbers.
    View Answer
    There is any methodology in which we can print a string in c without using semicolon(;)
    suggest me if there is ?
    View Answer
    What is the difference between the following statements?
    int a[4]={1,2,3,4};
    int a[]={1,2,3,4);
    View Answer
    How can we get direct printout of a c file without giving print command from bin or tc?eg i want to get the printout of a program directly after execution from the c window itself.
    View Answer
    Write a C program that will convert Simple Sentence to Complex/Compound Sentence.
    View Answer
    Can anyone share his code which would accept a sentence, then count the number occurrence of the words excluding spaces.All is done using linked list.
    View Answer
    using c-strings write a program that will analyse the text"1.1my brother is taller than me.1.2 I am a boy of sixteen years old". The program should remove multiple spaces betweem words,find the longest word in the text,search and identify the number of letters"e", extact the number of integers , extract the number of doubles, extract the number of words in each sentence and identify the number of sentences in the text.
    View Answer

    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL C Interview Questions & Answers

    User Options
    India News Network

    Latest 20 Questions
    Economics is the study of mankind in the ordinary business of life was given by: a)Adam Smith b)Lord Robbins c)Alfred Marshall d)Samuelson
    Agreement of Trial Balance is not a ________ proof of accuracy. a) Submissive b) Inclusive c) Exhaustive d) Conclusive
    _________ is prepared to ascertain the arithmetical accuracy of posting and balancing a) Cash Book b) Journal c) Trial Balance d) Bank Reconciliation Statement
    Closing stock in the trial balance implies that. a) It is already adjusted in the opening stock b) It is adjusted in Sales A/c. c) It is adjusted in the Purchase A/c. d) None of these
    Trial Balance creates ________ accuracy. a) Principle b) Arithmetical c) Clerical d) None
    Which of the following in Trial Balance is contradictory to each other? a) Inventory and Drawings b) Sales and Purchase Return c) Carriage Inward and Outward d) Trade Receivable and Liability
    Which of the following is not a process in the preparation of a Trial Balance? a) Recording b) Summarizing c) Classifying d) Interpretation
    A list which contains balances of accounts to know whether the debit and credit balances are matched. a) Balance Sheet b) Day Book c) Journal d) Trial Baalnce
    Balances of the Accounts are transferred to: a) Trial Balance b) Trading Account c) Profit & Loss Account d) Balance Sheet
    Trial Balance is prepared on : a) End of the year b) A particular date c) For the period ending_______ d) Both "a" and "b"
    A Trial Balance contains the balances of: a) Only personal and real accounts b) Only real and nominal accounts c) Only nominal and personal accounts d) All accounts
    Trial Balance under balance method is known as: a) Gross Trial Balance b) Net Trial Balance c) Simple Trial Balance d) Trial Balance Appropriation
    Difference of totals of both debit and credit side of trial balance is transferred to: a) Trading Account b) Suspense Account c) Difference Account d) Miscellaneous Account
    The trial balance of M/S RAM & Co. shows closing stock of Rs. 30,000. It will be recorded in: a) Trading Account b) Profit and Loss Account c) Balance Sheet d) Both (a) and (c)
    The preparation of trial balance is for: a) Locating errors of commission b) Locating errors of principle c) Locating clerical errors d) All of the above
    Trial Balance is a: a) Statement b) Account c) Summary d) Ledger
    Methods of preparation of Trial Balance are: a) Balance Method b) Total Method c) Total and Balance Method d) All of these
    What is Constructive Dividend in Taxation?
    What is Consolidated tax return in Taxation?
    What is Conduit Approach in Taxation?



    Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

    Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

    MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
    MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

    GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

    IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
    IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

    SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
    SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




    Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions



    Cache = 1.054688 Seconds