Questions
Which of the following file opening modes in C is/are invalid?
- O_CREATE
- O_EXCEL
- O_BINARY
- O_TEXT
- Both 1 and 4
Which of the following statements is/are correct?
- A compiler does the same function as an interpreter.
- Instructions in C programs are terminated by semicolon.
- American National Standard Institute (ANSI) of C was set up in 1983.
- C is a middle level language.
- Both 2 and 3.
Which of the following statements is/are correct?
- The element number in array plays a major role in calling each element of the array.
- Execution time with a pointer is little slow.
- An external variable is declared outside the body of a function.
- Both 1 and 3.
- None of these
What is the ASCII value of O (capital)?
- 79
- 80
- 110
- 111
- None of these
Which of the following is/are invalid C keyword(s)?
- Brake
- Extern
- Const
- Both 1 and 3
- None of these
Which of the following is/are not standard string function(s) of C library?
- Strpbrk ();
- Strbrk ();
- Strtok ();
- Strncmp ();
- Strstr ();
Which of the following statements is/are incorrect?
- The element number in array plays a major role in calling each element of array.
- The execution time with pointer is slower.
- An external variable is declared outside the body of a function.
- Both 2 and 3
- None of these
Which of the following operators are arranged from higher to lower priority in solving any particular expression?
- (>>) > (&) > (^) > (&&) = (sizeof)
- (sizeof) > (&) = (^) > (&&) > (>>)
- (&) = (sizeof) > (>>) > (^) > (&&)
- (^) > (&&) = (>>) > (&) > (sizeof)
- None of these
Find the output of the above program or error, if any.
#include<stdio.h>
#include<conio.h>
int num(int);
int main()
{
int n=9,t;
t=num(n);
printf("\\n the result is %d",t);
getch();
}
int num(int m)
{
int f=0;
if(m==0)
return (f);
else
{
f=f+m+num(m-1);
return (f);
}
}
- The result is 35.
- The result is 47.
- The result is 45.
- The result is 35.
- There is error in the program.
Which of the following statements about the above program is correct if we enter the number as 1111?
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
long n;
int x,y=0,p=0;
printf("enter number");
scanf(%d,&n);
while(n!=0)
{
x=n%10;
if(x>1 || x<0)
{
printf("invalid" );
exit(1);
}
y=y+x*pow(2,p);
n=n/10;
p++;
}
printf("answer is %d",y);
getch();
}
- Program will find the sum of digits.
- Program will find the number of digits.
- Invalid
- Program will run infinite times.
- There will be error in the program.
Find the output of the above program or error, if any.
#include<stdio.h>
#include<conio.h>
int main()
{
int a=8, b=2,c;
c=a^b;
printf(“the result is C=%d”,c);
getch();
}
- The result is C = 8.
- The result is C = 10.
- The result is C = 16.
- The result is C = 0.
- Error in the program.
Which of the following options shows the output or error of the above program?
#include<stdio.h>
#include<conio.h>
#define plus(x) x;
#define minus(x) --x + plus(x);
int main()
{
int x=8,y;
y=minus(x);
printf("y=%d",y);
getch();
}
- Y = 14
- Y = 15
- Y = 13
- None of these
- Error in the program
Find the output of the program or error, if any.
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int f=1,l,i,x=4,y=4;
float s;
s=x;
for(i=2;i<=y;i+=2)
{
f=1;
for(l=1;l<=i;l++)
f=f*l;
s=s+pow(x,i)/f;
}
printf("\\n result is %f" ,s);
getch();
}
- 22.3333
- 22.666666
- 22.999999
- 22.3366
- Error in the program
Find the output of the above program or error, if any.
#include<stdio.h>
#include<conio.h>
int main()
{
int a=4,b=8,c;
c=a | b;
printf(“the result is C=%d”,c);
getch();
}
- C = 0
- C = 32
- C = 12
- C = 8
- Error in the program
If we enter the number as 1111, which of the following statements about the above program is/are correct?
#include
#include
#include
#include
int main()
{
long n;
int x,y=0,p=0;
printf("enter number");
scanf(%d,&n);
while(n!=0)
{
x=n%10;
i f(x>1 || x<0)
{
printf("invalid" );
exit(1);
}
y=y+x*pow(2,p);
n=n/10;
p++;
}
printf("answer is %d",y);
getch();
}
- The program will find the sum of digits.
- The program will find the number of digits.
- Invalid
- The program will run infinite times.
- There is a error in the program.