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.
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 |
|
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 |
|
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 |
|
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 |
|
SQL Server 2000: Creating Stored Procedure with Input and Output Parameters | |
This tutorial explains how to create and use Stored Procedures with Input Parameters and output parameters along with the screen shots and sample code Creating Stored Procedure with Input Parameters mosgoogle Input Parameters in Stored Procedures are placeholders for data that the user needs to send |
|
|