GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Placement Papers  >  TCS  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 29 of 87    Print  
consider the following program sigment
int n,sum=1;
switch(n) {
case 2:sum=sum+2;
case 3:sum*=2;
break;
default:sum=0;}
if n=2, what is the value of sum
a.0
b.6
c.3
d.none
B



  
Total Answers and Comments: 2 Last Update: December 21, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 29, 2006 15:01:25   #1  
ab        

RE: consider the following program sigmentint n,su...
ans is d
 
Is this answer useful? Yes | No
December 21, 2008 11:51:25   #2  
Bhoomika sharma Member Since: December 2008   Contribution: 39    

RE: consider the following program sigmentint n,sum=1;switch(n) {case 2:sum=sum+2;case 3:sum*=2;break;default:sum=0;} if n=2, what is the value of suma.0b.6c.3d.none

As we have n=2, thus control goes to case2: thus,value of sum becomes 3 and since there is no break stmt thus,sum is again found as (2*3)=6.Thus the value of sum is 6.


 
Is this answer useful? Yes | No

 Related Questions

Main must be written asa.the first function in the programb.Second function in the programc.Last function in the programd.any where in the program

What does the following code do?fn(int n,int p,int r){static int a=p;switch(n){case 4:a+=a*r;case 3:a+=a*r;case 2:a+=a*r;case 1:a+=a*r;}}a.computes simple interest for one yearb.computes amount on compound interest for 1 to 4 yearsc.computes simple interest for four year d.computes compound interst for 1 year

Consider the following programmain(){int a[5]={1,3,6,7,0};int *b;b=&a[2];}the value of b[-1] isa.1b.3c.-6d. none

# define prod(a,b)=a*bmain(){int x=2;int y=3;printf("%d",prod(x+2,y-10)); }the output of the program is a.8b.6c.7d.none

Consider the following program sigmentint n,sum=1;switch(n) {case 2:sum=sum+2;case 3:sum*=2;break;default:sum=0;} if n=2, what is the value of suma.0b.6c.3d.none

Find the output of the following programmain(){int x=5, *p;p=&x;printf("%d",++*p);}a.5b.6c.0d.none

Main must be written asA. The first function in the programB. Second function in the programC. Last function in the programD. Any where in the program

What does the following code do?fn(int n, int p, int r){static int a=p;switch(n)  {   case 4:a+=a*r;   case 3:a+=a*r;   case 2:a+=a*r;   case 1:a+=a*r;   }}A. computes simple interest for one yearB. computes amount on compound interest for 1 to 4 yearsC. computes simple interest for four yearD. computes compound interest for 1 year

Consider the following programmain(){unsigned int i=10;while(i>=0)  {   printf("%u",i)   i--;   }}How many times the loop will get executedA.10B.9C.11D. infinite

Consider the following programmain(){int a[5]={1,3,6,7,0};int *b;b=&a[2];}The value of b[-1] isA. 1B. 3C. -6D. none


 Sponsored Links

 
Related Articles

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.   When a programmer wants other than integer values to be returned from function then it is essential that the pro
 

How to develop compile and run a C program

The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
 

What are the limitations with switch statement?

Switch statement is a powerful statement used to handle many alternatives and provides good presentation for C program. But there are some limitations with switch statement which are given below: Logical operators cannot be used with switch statement. For instance case k>=20: is not allowe
 

UML Elements : Use Case Diagram

UML Elements Use Case Diagram In the Unified Modeling Language a use case diagram is a subset of the behavior diagrams The Unified Modeling Language will utilize the use case diagram as a graphical system which symbolizes use cases mosgoogle center It must be noted that UML will not define the stand
 

Quality Aspects to Check While Writing COBOL Program

Quality Aspects to Check While Writing COBOL Program This article gives a general list which the programmer must check while delivering programs developed in COBOL This can also be used as a general checklist for checking quality of the COBOL program developed mosgoogle Quality is a vital factor fo
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 

Online Degree Program Information

Online Degree Program Information While the concept of distance learning is not recent the use of the internet to earn degrees online is a relatively new concept The beginning of what would become a revolution in education started in the middle of the 1990s mosgoogle It was during this time that hig
 

Break Out Of The Rookie Mold

Break Out Of The Rookie Mold Breaking into the career of your choice can be difficult when you have had very little experience College graduates are often thought of as the new kid or the rookie but there are some things that you can do to avoid this label because once you’ ve been given t
 

SQL Server 2005 - Management studio interface Summary Page

SQL Server 2005 Management studio interface  Summary Page The summary page appears as the largest window on the Management studio interface This window presents information about the item selected in the object window The summary page can be configured to start as soon as SQL Server Managem
 

Exforsys Certification Practice Program Version 1 Uploaded

Exforsys Certification Practice Version 1 Uploaded We are glad to let you know that we have completed Certification Testing Module changed and bug fixes It s now avaiable for download and practice for the exams from your home PC We are giving this program for free at no charge all we ask in return y
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape