OBJECTIVE C (25 Questions) online Test

#include<stdio.h>

void main()

{

int x = 3, counter = 0;

while ((x-1))

{

++counter;

x--;

}

printf("%d",counter);

}


#include<stdio.h>

void main()

{

int x = 5;

int y = 2;

char op = '*';

switch (op)

{

default : x += 1;

case '+' : x += y;

case '-' : x -= y;

}

printf("%d",x);

}


#include<stdio.h>

#include<math.h>

void main()

{

double x = -3.5, y = 3.5;

printf( "%.0f : %.0f\n", ceil( x ), ceil( y ) );

printf( "%.0f : %.0f\n", floor( x ), floor( y ) );

}


#include<stdio.h>

#include<math.h>

void main()

{

int x = 3;

if( x == 2 );

x = 0;

if( x == 3 )

x++;

else x += 2;

printf("%d",x);

}


#include<stdio.h>

void main()

{

int x = 0;

for (x=1; x<4; x++);

printf("x=%d\n", x);

}


What is a difference between a declaration and a definition of a variable?


int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

What value does testarray[2][1][0] in the sample code above contain?


int a=10,b;

b=a++ + ++a;

printf("%d,%d,%d,%d",b,a++,a,++a);


#include<stdio.h>

void myFunc (int x)

{

if (x > 0)

myFunc(--x);

printf("%d",x);

}

int main()

{

myFunc(5);

return 0;

}


11 ^ 5

What does the operation shown above produce?


int x = 2 * 3 + 4 * 5;

What value will x contain in the sample code above?


#include <stdio.h>

int i;

void increment( int i )

{

i++;

}

int main()

{

for( i = 0; i < 10; increment( i ) )

{

}

printf("i=%d\n", i);

return 0;

}


int x = 0;

for ( ; ; )

{

if (x++ == 4)

break;

continue;

}

printf("x=%d\n", x);


char txt [20] = "Hello world!\0";

How many bytes are allocated by the definition above?


penny = one

nickel = five

dime = ten

quarter = twenty-five

How is enum used to define the values of the American coins listed above?


#include<stdio.h>

void main()

{

int i = 4;

int x = 6;

double z;

z = x / i;

printf("z=%.2f\n", z);

}


Which one of the following is valid for opening a read-only ASCII file?


short int x; /* assume x is 16 bits in size */

What is the maximum number that can be printed using printf("%d\n", x), assuming that x is initialized as shown above?


#include <stdio.h>

void func()

{

int x = 0;

static int y = 0;

x++; y++;

printf( "%d -- %d\n", x, y );

}

int main()

{

func();

func();

return 0;

}


c = getchar();

What is the proper declaration for the variable c in the code above?


main()

{

float me = 1.1;

double you = 1.1;

if(me==you)

printf("I love U");

else

printf("I hate U");

}


main()

{

int i=-1,j=-1,k=0,l=2,m;

m=i++&&j++&&k++||l++;

printf("%d %d %d %d %d",i,j,k,l,m);

}


main()

{

int c=- -2;

printf("c=%d",c);

}


#define int char

main()

{

int i=65;

printf("sizeof(i)=%d",sizeof(i));

}


main()

{

int i=10;

i=!i>14;

Printf ("i=%d",i);

}




















































































































































































































































































































Description:

for Placement Purpose

Comments

Want to learn?

Sign up and browse through relevant courses.

or fill this simple form
Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as shown in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy

Your Facebook Friends on WizIQ

More Tests By Author

C objective
11 Questions | 125 Attempts

Connect