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.
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.
Attitude Development : Practice Makes Perfect | |
Practice Makes Perfect Can Practicing Help Improve My Attitude You bet it does But it is not as simple as merely practicing” whatever it is that you want to get good at You have to learn how to practice the right way Indeed practicing can be used in virtually every profession as a way of |
|
C++ Standard Input Output Stream | |
C Standard Input Output Stream In this C tutorial you will learn about standard input stream and standard output stream explained along with syntax and examples C programming language uses the concept of streams to perform input and output operations using the keyboard and to display information on |
|
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 |
|
Short-term versus Long-term Job Experience | |
One big question in today’s career world asks which resume is more beneficial, one that shows numerous types of jobs performed for the short term, or a few jobs in the same field where the employee remained for the long term? Most career professionals would state that the latter is more va |
|
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 |
|
How Consistent Practice Can Help You Improve Your Memory | |
How Consistent Practice Can Help You Improve Your Memory Researchers have known for a long time that learning a skill in set intervals is the best way to master it Instead of teaching someone a large number of things at once they learn better when the information is split apart in sections mosgoogle |
|
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 |
|
How To Make Sure Your Essay Is Perfect | |
How To Make Sure Your Essay Is Perfect When you write an essay it is important to make sure your document uses good grammar While this may sound like common sense you would be surprised by the number of people that make this mistake mosgoogle Even if your essay presents good ideas it will be rejecte |
|
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 |
|
C Programming - Managing Input and Output Operations | |
C Programming Managing Input and Output Operations In this tutorial you will learn about Single character input output String input and output Formatted Input For Scanf Input specifications for real number Input specifications for a character Printing One Line Conversion Strings and Specifiers Speci |
|
|