GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Sonata  >  C
Next Question 
 C  |  Question 1 of 31    Print  
Point out error, if any, in the following program
main()
{
int i=1;
switch(i)
{
case 1:
printf("nRadioactive cats have 18 half-lives");
break;
case 1*2+4:
printf("nBottle for rent -inquire within");
break;
}
}
No error. Constant expression like 1*2+4 are acceptable in cases of a switch.




  
Total Answers and Comments: 0 Last Update: N/A   
  
 Sponsored Links

 

No answers are posted for this question yet.
Be the first to answer it!


 Related Questions

Point out error, if any, in the following program main() { int i=1; switch(i) { case 1: printf("nRadioactive cats have 18 half-lives"); break; case 1*2+4: printf("nBottle for rent -inquire within"); break; } }
No error. Constant expression like 1*2+4 are acceptable in cases of a switch.  

Point out the error, if any, in the following program main() { int a=10,b; a>= 5 ? b=100 : b=200; printf("n%d",b); }
lvalue required in function main(). The second assignment should be written in parenthesis as follows: a>= 5 ? b=100 : (b=200);  

What would be the output of the following program? main() { int i=4; switch(i) { default: printf("n A mouse is an elephant built by the Japanese"); case 1: printf(" Breeding rabbits is a hair raising experience"); break; case 2: printf("n Friction is a drag"); break; case 3: printf("n If practice make perfect, then nobody's perfect"); } } a) A mouse is an elephant built by the Japanese b) Breeding rabbits is a hare raising experience c) All of the above

What is the output of the following program? #define SQR(x) (x*x) main() { int a,b=3; a= SQR(b+2); printf("%d",a); } a) 25 b) 11 c) error d) garbage value

In which line of the following, an error would be reported? 1. #define CIRCUM(R) (3.14*R*R); 2. main() 3. { 4. float r=1.0,c; 5. c= CIRCUM(r); 6. printf("n%f",c); 7. if(CIRCUM(r))==6.28) 8. printf("nGobbledygook"); 9. } a) line 1 b) line 5 c) line 6 d) line 7

In the following code; #include main() { FILE *fp; fp= fopen("trial","r"); } fp points to: a) The first character in the file. b) A structure which contains a "char" pointer which points to the first character in the file. c) The name of the file. d) None of the above.
Tags : Pointer

If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output? main(int argc, char *argv[]) { int i; for(i=0;i

If the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output? main(int argc, char *argv[]) { int i,j=0; for(i=0;i

If the following program (myprog) is run from the command line as myprog monday tuesday wednesday thursday, What would be the output? main(int argc, char *argv[]) { while(--argc >0) printf("%s",*++argv); } a) myprog monday tuesday wednesday thursday b) monday tuesday wednesday thursday c) myprog tuesday thursday d) None of the above

Point out the error in the following program main() { const int x; x=128; printf("%d",x); }
x should have been initialized where it is declared.  


 Sponsored Links

 
Related Articles

Point to Point Protocol (PPP)

Point to Point Protocol PPP The Point to Point Protocol is a platform that is used to connect any individual computer or a network to the internet service provider The connection is established between two points only and that is why it is called Point to Point Protocol The PPP is considered be the
 

What is 1000BASE-T Standard

1000BASE-T, or IEEE 802.3ab, is a Gigabit Ethernet wiring standard for Local Area Networks (LAN) that uses copper-based networking hardware as its medium. It is one of the most widely used standards of Ethernet over twisted pair. The Institute of Electrical and Electronics Engineers Standards Associ
 

What is 100BASE-T Standard

100BASE-T is a subset of Fast Ethernet that refers collectively to a number of Ethernet wiring standards that carry signals at 100Mbps over twisted pair cables. Its IEEE-designated identifier is derived from its characteristics. "100" refers to its rate of transmission of Ethernet
 

What is 10BASE-T Standard

10BASE-T is an Ethernet standard for local area networks (LAN) that requires only one copper twisted pair cable of Category 3 (CAT-3) or higher, either unshielded twisted pair (UTP) or shielded twisted pair (STP), for a maximum network segment length of 100 meters for UTP, or 200 meters for STP. I
 

What is 10BASE5 Standard

10BASE5 is an Ethernet standard that requires a specialized coaxial cable to transmit Ethernet frames at a rate of 10Mbps. It is also known as "Thick Ethernet" or "Thicknet" because of the thick coaxial cable it uses, which is 0.375 inches in diameter. Its desig
 

What is 10BASE2 Standard

10BASE2, or IEEE 802.3, is an early Ethernet Standard that makes use of industry-standard RG-58 coaxial communications cables connected to BNC T-connectors. 10BASE2 gets its identifier, assigned by the Institute of Electrical and Electronics engineers (IEEE), from the following characteristics: &
 

What is 1xEV-DV Standard

1xEV-DV, which is short for CDMA2000 1xEV-DV, is a third generation (3G) standard developed to compete against the Evolution-Data Optimized (CDMA2000 1xEV-DO) standard. It was an innovation of a number of cellular wireless telecommunication companies such as Nokia, Motorola, Qualcomm and Lucent. &a
 

What is Access Point

An access point (AP; or also "WAP" for "wireless access point") is a node responsible for the formation of a wireless network through connection between wireless communication devices. It acts as a central transmitter and receiver of wireless radio signals, and is
 

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
 

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
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape