0

C Language

Description: C Language
Number of Questions: 15
Created by:
Tags: C Language Java/Oracle /C/C++
Attempted 0/15 Correct 0 Score 0

Which of the following file opening modes in C is/are invalid?

  1. O_CREATE

  2. O_EXCEL

  3. O_BINARY

  4. O_TEXT

  5. Both 1 and 4


Correct Option: A
Explanation:

This mode is invalid.

Which of the following statements is/are correct?

  1. A compiler does the same function as an interpreter.

  2. Instructions in C programs are terminated by semicolon.

  3. American National Standard Institute (ANSI) of C was set up in 1983.

  4. C is a middle level language.

  5. Both 2 and 3.


Correct Option: E
Explanation:

This option is true.

Which of the following statements is/are correct?

  1. The element number in array plays a major role in calling each element of the array.

  2. Execution time with a pointer is little slow.

  3. An external variable is declared outside the body of a function.

  4. Both 1 and 3.

  5. None of these


Correct Option: D
Explanation:

This option is true.

What is the ASCII value of O (capital)?

  1. 79

  2. 80

  3. 110

  4. 111

  5. None of these


Correct Option: A
Explanation:

Yes, it is correct.

Which of the following is/are invalid C keyword(s)?

  1. Brake

  2. Extern

  3. Const

  4. Both 1 and 3

  5. None of these


Correct Option: A
Explanation:

Brake is not a valid C keyword.

Which of the following is/are not standard string function(s) of C library?

  1. Strpbrk ();

  2. Strbrk ();

  3. Strtok ();

  4. Strncmp ();

  5. Strstr ();


Correct Option: B
Explanation:

Strbrk() is not a standard string function.

Which of the following statements is/are incorrect?

  1. The element number in array plays a major role in calling each element of array.

  2. The execution time with pointer is slower.

  3. An external variable is declared outside the body of a function.

  4. Both 2 and 3

  5. None of these


Correct Option: B
Explanation:

The execution time with pointers is very fast.

Which of the following operators are arranged from higher to lower priority in solving any particular expression?

  1. (>>) > (&) > (^) > (&&) = (sizeof)

  2. (sizeof) > (&) = (^) > (&&) > (>>)

  3. (&) = (sizeof) > (>>) > (^) > (&&)

  4. (^) > (&&) = (>>) > (&) > (sizeof)

  5. None of these


Correct Option: C
Explanation:

This order is correct.

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);

   }

}

  1. The result is 35.

  2. The result is 47.

  3. The result is 45.

  4. The result is 35.

  5. There is error in the program.


Correct Option: C
Explanation:

The correct answer is 45.

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();

}

  1. Program will find the sum of digits.

  2. Program will find the number of digits.

  3. Invalid

  4. Program will run infinite times.

  5. There will be error in the program.


Correct Option: C
Explanation:

This option is correct.

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();

}

  1. The result is C = 8.

  2. The result is C = 10.

  3. The result is C = 16.

  4. The result is C = 0.

  5. Error in the program.


Correct Option: B
Explanation:

The correct answer is 10.

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();

}

  1. Y = 14

  2. Y = 15

  3. Y = 13

  4. None of these

  5. Error in the program


Correct Option: A
Explanation:

The result is 14.

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();

}

  1. 22.3333

  2. 22.666666

  3. 22.999999

  4. 22.3366

  5. Error in the program


Correct Option: B
Explanation:

The correct answer is 22.666666.

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();

}

  1. C = 0

  2. C = 32

  3. C = 12

  4. C = 8

  5. Error in the program


Correct Option: C
Explanation:

The correct answer is 12.

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();

}

  1. The program will find the sum of digits.

  2. The program will find the number of digits.

  3. Invalid

  4. The program will run infinite times.

  5. There is a error in the program.


Correct Option: C
Explanation:

This option is correct.

- Hide questions