CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.

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 733
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
What is an execution plan? When would you use it?
What is BCP? When does it used?
What are the advantages of using Stored Procedures?
What is a Scheduled Jobs or What is a Scheduled Tasks?
What is NOT NULL Constraint?
What is CHECK Constraint?
What is FOREIGN KEY?
What is UNIQUE KEY constraint?
What is PRIMARY KEY?
What is the difference between a Local and a Global temporary table?
Name 3 ways to get an accurate count of the number of records in a table?
What is Log Shipping?
What is SQL Server Agent?
Which command using Query Analyzer will give you the version of SQL server and operating system?
What are the authentication modes in SQL Server? How can it be changed?
What is SQL Profiler?
What are the properties and different Types of Sub-Queries?
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
When is the use of UPDATE_STATISTICS command?
What is difference between DELETE and TRUNCATE commands?



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 = 0.015625 Seconds