C Programming

Test your C skill in programming language for campus placements by free online preparation and practice paper tests

24 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following is not an identifier?

  1. Area_of_circle
  2. Pi-value
  3. 4th semester
  4. Count2
Question 2 Multiple Choice (Single Answer)

If i, j and k are integer variables with values 8, 15 and 4 respectively, the arithmetic expression 2 * ((i % 5) * (4 + (j - 3) / (k + 2))) results

  1. 26
  2. 36
  3. 34
  4. 32
Question 3 Multiple Choice (Single Answer)

Unsigned integer quantities are

  1. greater than ordinary integer quantities
  2. greater than ordinary integer quantities and can be negative
  3. lesser than ordinary integer quantities and cannot be negative
  4. greater than ordinary integer quantity and cannot be negative
Question 4 Multiple Choice (Single Answer)

The use of the function floor (d) returns the

  1. value round down to the next integer value
  2. absolute value of d
  3. value round up to the next integer
  4. none of these
Question 5 Multiple Choice (Single Answer)

What is the correct precedence of the following operators?
!=, &&, *, >=

  1. &&, *, >=, !=
  2. *, >=, !=, &&
  3. *, !=, &&, >=
  4. >=, !=, &&, *
Question 6 Multiple Choice (Single Answer)

In the under given expression
flag = (i < 10) ? 0 : 100
if the value of 'i' is 12, then the result is

  1. 0
  2. 10
  3. 100
  4. 12
Question 7 Multiple Choice (Single Answer)

Suppose a, b and c are integer variables assigned values 8, 3 and -5 respectively. In this case, the respective values of arithmetic expressions (ac)%b and a(c%b) are

  1. -1 & 16
  2. 1 & 16
  3. 1 & -16
  4. -1 & -16
Question 8 Multiple Choice (Single Answer)

If a C program contains the following declarations
long ix;
double dx;
the data type of the expression ((int)dx) + ix is

  1. double precision
  2. double
  3. long integer
  4. integer
Question 9 Multiple Choice (Single Answer)

Is it possible to write the following expression?
for(expression 1a, expression 1b; expression 2; expression 3)
{
statement;
}

  1. Yes
  2. No
Question 10 Multiple Choice (Single Answer)

If the declaration is float x = 123.456, then the statement printf(“%7f %7.1f “,x,x) will print

  1. 123.456000 & 123.5
  2. 123.456 & 123.4
  3. 123.4560000 & 123.5
  4. 123.456000 & 123.0
Question 11 Multiple Choice (Single Answer)

For the statement 'scanf(“%3d %3d %3d”,&a,&b,&c)'; if the input value is 1234 5678 9, then the assignments will be

  1. a=123 b=456 c=789
  2. a=123 b=567 c=9
  3. a=123 b=4 c=567
  4. a=123 b=678 c=9
Question 12 Multiple Choice (Single Answer)

Break statement is used to terminate _____ loop(s).

  1. for
  2. while
  3. do-while
  4. all of the above
Question 13 Multiple Choice (Single Answer)

The syntax of the switch statement is
switch (expression) statement
is true when the expression results in

  1. integer
  2. char
  3. float
  4. either int or char
Question 14 Multiple Choice (Single Answer)

The function definition of the statement “A function called process accepts an integer and two floating point numbers and returns a double precision quantity”, is

  1. float process( int i, float a, float b)
  2. double process(int i, double a, double b);
  3. double process (int i, float a, float b);
  4. long process(int i, float a, float b);
Question 15 Multiple Choice (Single Answer)

Which of the following is a wrong declaration of array?

  1. int digits[5]={1,2,3,4,5};
  2. float num[10];
  3. char color[3]={R,G,B};
  4. static float x[3]={2.5, 6.2, 7.8};
Question 16 Multiple Choice (Single Answer)

The strcmp function is used to __________.

  1. compare three strings
  2. compare two strings
  3. copy strings
  4. compare and then copy strings
Question 17 Multiple Choice (Single Answer)

The array declaration - float num[3][4][5] - will have ____ elements.

  1. 12
  2. 17
  3. 35
  4. 60
Question 18 Multiple Choice (Single Answer)

The declaration
char flag[]=”TRUE” will result in

  1. flag is a one dimensional, 4 element, character array;
  2. flag is a one dimensional, 5 element, character array;
  3. flag is a one dimensional character array containing TRUE or FALSE
  4. the declaration is wrong
Question 19 Multiple Choice (Single Answer)

Consider the following program segment:
main()
{
int a=2;
printf (“a= %d”,a);
modify(a);
printf (“a= %d”,a);
}
modify(a)
{
a*=3;
printf (“a= %d”,a);
return;
}
The answer printed after executing this program will be

  1. a=2 a=2 a=2
  2. a=2 a=6 a=2
  3. a=2 a=6 a=6
  4. none of these
Question 20 Multiple Choice (Single Answer)

The statement to declare a two dimensional floating point array of 15 rows and 30 columns using pointer, is

  1. float *(15)[30];
  2. float [15][30];
  3. float *(x)[30];
  4. float *x[30];
Question 21 Multiple Choice (Single Answer)

The declaration int *px means that

  1. p is a pointer to integer x
  2. both p and x are pointers to integer quantity
  3. px is an array of integer pointer
  4. px is a pointer to an integer quantity
Question 22 Multiple Choice (Single Answer)

The output of the following program is
main()
{
int a, b, c;
int num[3][4]= {1,2,3,4,5,6,7,8,9,10,11,12};
for(a=0;a<3;++a)
{
c=999;
for(b=0;b <4;++b)
if (z[a][b]<c)
c=z[a][b];
printf(“ %d”,c);
}
}

  1. 1 5 9
  2. 4 8 12
  3. 1 4 7 10
  4. 1 3 6 9 12
Question 23 Multiple Choice (Single Answer)

C pre-processor is a collection of special statements, called directives, which are executed _________.

  1. as and when required
  2. at the end of the compilation process
  3. at the beginning of the compilation process
  4. while running the program
Question 24 Multiple Choice (Single Answer)

A C program contains following declaration:
char text[80];
The for statement that permit a 60 character message and store it in array text is ________
text[i]=getchar();

  1. for(i=0;i<80;++i)
  2. for(i=0;i<=60;i++)
  3. for(i=1;i<60;i++)
  4. for(i=0;i<60;++i)