C Programs
C Programs
#include<stdio.h>
int main()
{
float a=0.7;
if(a < 0.7)
printf("C\n"); 7.Point out the error in the program?
else
printf("C++\n");
return 0; #include<stdio.h>
}
int main()
OPTIONS: {
int a[] = {10, 20, 30, 40, 50};
A) C
int j;
B) C++ for(j=0; j<5; j++)
C) Compiler error {
printf("%d\n", a);
D) Non of above a++;
Answer:A }
return 0;
}
OPTIONS:
A) “ and ‘ B) { and ‘ and return0
C) : and ; D) ” and ; and getch()
Answer: D
9.find out the error of the following
program:
10.find out the error of the following?
#include<stdio.h> #include<stdio.h>
#include<conio.h>
void main () Int main()
{ {
char s[20];
clrscr(); int num1,num2,sum:
printf(“enter the string?”); printf(“enter two integers: “);
gets(s)
printf(“you entered %c”,s); scanf(“%d %d”,&num1,&num2);
getche() sum= num1+num2;
}
printf(“% d= %d”,num1,num2,sum);
return 0;
OPTIONS:
A) geche() and ; }
B) : and getch OPTIONS:
C) getch() and ;
D) clrscr and gets() A) return 0
B) + %d and ;
C) :
Answer: C
D) %d
Answer:B