Sunday, December 28, 2008

What is the output of following programme ?

main()
{
float b=7.7;
char a='7';
if('7'>a)
printf("this world is good and ");
else printf("not so bad after all ");
if(7.7>b)
printf("this world is good ");
else printf("not so bad after all");
}

a. not so bad after all not so bad after all
b. this world is good and this world is good
c. this world is good and not so bad after all
d. not so bad after all this world is good


Friday, December 26, 2008

What is the output of following programme ?

main()
{
char x = 0x8A;
unsigned int y = x;
printf("%d\n", y);
}
A. -118
B. 138
C. 118
D. Unpredictable

Wednesday, December 17, 2008

Which of the following is the correct output for the program given below?

main() {
char ch;
if((ch=printf(248)))
printf("You are Boss");
else
printf("I am Boss");
}

a. You are Boss
b. I am Boss
c. No output
d. None of these

Saturday, December 6, 2008

Find the output of following programme

#include
#include
int main()
{
printf("%c\n", 'mujhe khoon do main tumhe pani duungah' -3);
return 0;
}

a. warning,Outputs: -h
b. error
c. warning, Outputs: e
d. warning, Outputs: n
e. warning, Outputs: (ascii value of h)

Friday, December 5, 2008

What is the output of following programme ?

int main()
{
int a[5]={0,1,2,3,4,5};
unsigned int b = 0xffffffff;
a[b] = 30;
printf("%d\n", a[-1]);
a[-1] = 50;
printf("%d %d\n", a[-1],b);
}

a. Error
b. Garbage Garbage 1
c. 30 50 -1
d. -30 -50 1
e. None of the above

Tuesday, December 2, 2008

What is the output of following programme ?

main()
{
int a=500, b=100, c;
if(!a>=400)
b=300; c=200;
printf("b=%d c=%d", b,c);
}

a. b=300 c=200
b. b=100 c=garbage
c. b=300 c=garbage
d. b=100 c=200

Monday, December 1, 2008

According to the Standard C specification, what are the respective minimum ranges (in bytes) of the following three data types: short, int, long?

Choice a: 1, 2, 2
Choice b: 2, 4, 8
Choice c: 2, 2, 4
Choice d: 2, 4, 4
Choice e: 1, 2, 8

Saturday, November 29, 2008

Predict the counter value

x = 3, counter = 0;
while ((x-1))
{
++counter;
x--;
}

Choice a: 0
Choice b: 1
Choice c: 2
Choice d: 3
Choice e: 4


Predict the output of following programme

void myFunc (int x)
{
if (x > 0)
myFunc(--x);
printf("%d, ", x);
}
int main()
{
myFunc(5);
return 0;
}

Choice a: 1, 2, 3, 4, 5, 5,
Choice b: 4, 3, 2, 1, 0, 0,
Choice c: 5, 4, 3, 2, 1, 0,
Choice d: 0, 0, 1, 2, 3, 4,
Choice e: 0, 1, 2, 3, 4, 5,

Friday, November 28, 2008

Point out the error if any

main() {
int i=1;
while()
{ printf("%d",i++);
if(i>10) break; }
}

a. The condtion in the while loop is must
b. There should be atleast a semicolon in the while()
c. The while loop should be replaced by the for loop
d. No Error

Tuesday, November 18, 2008

What is the output of following programme ?

main() {
int i, x=10, y=100%90;
for(i=1;i<=10;i++) if(x!=y) printf("x=%d y=%d", x,y); } a. The printf() function is called 10 times b. The program will produce the output x=10 y=10 c. The program will not produce any output d. The printf() function is called infinite times

Tuesday, November 11, 2008

You want to declare a pointer to an array of 20 elements containing double values.

Which one of the following statements do you use to declare a pointer to an array of 20 elements containing double values?

Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];

Monday, November 10, 2008

You make a change to a C program and run the binary. When the binary is run, it produces the same results as before the change.

It seems like the change has not been honored.
Given the scenario described above, how do you fix the problem?

Choice a: Recompile the program.
Choice b: Clear the program cache and run the binary again.
Choice c: Run ./configure to reconfigure the program.
Choice d: Restart the resident set and run the program again.
Choice e: Touch the Makefile.

Sunday, November 2, 2008

What is the output of following programme ?

main() {
int x=10, y=20;
if(!!!!x||2&&x)
printf("x=%d", x);
else
printf("y=%d",y);
}

a. Y=20
b. X=10
c. X=-10
d. X=0
e. Error

Wednesday, October 29, 2008

What will happen when the program below is compiled and executed?

int i;
int increment( int *i )
{
return ++i;
}

int main()
{
  for( i = 0; i < 10; increment(i) ) 
   {} 

   printf("i=%d", i); 
 return 0;


Choice a: It will not compile
Choice b: It will print out i=9 
Choice c: It will print out i=10 
Choice d: It will print out i=11
Choice e: It will loop indefinitely

Tuesday, October 21, 2008

What will be printed when the sample code above is executed?

int x = 0;
for ( ; ; )
{
if (x++ == 4)
break;
continue;
}
printf("x=%d\n", x);

Choice a: x=0
Choice b: x=1
Choice c: x=4
Choice d: x=5
Choice e: x=6

Wednesday, October 15, 2008

What is the output?

void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
}
}

a) XAM is printed
b) EXAM is printed
c) Compiler Error
d) Nothing is printed

Monday, October 13, 2008

What will be the o/p of the below program

float i=5, j;

j = ++i/--i/--i*i;

printf(“%f\n”, j);

Choice

a) 0.75
b) 1.25
c) 1.2
d) 0.075
e) 1.000000


Sunday, October 12, 2008

What is the output of following programme ?

int i = 4;
switch (i)
{
default:
;
case 3:
i += 5;
if ( i == 8)
{
i++;
if (i == 9) break;
i *= 2;
}
i -= 4;
break;
case 8:
i += 5;
break;
}
printf("i = %d\n", i);

Choice a: i = 5
Choice b: i = 8
Choice c: i = 9
Choice d: i = 10
Choice e: i = 18

Monday, October 6, 2008

What will be printed when the sample code below is executed?

char *buffer = "0123456789";
char *ptr = buffer;
ptr += 5;
printf( "%s\n", ptr );
printf( "%s\n", buffer );

Choice a: 0123456789
56789
Choice b: 5123456789
5123456789
Choice c: 56789
56789
Choice d: 0123456789
0123456789
Choice e: 56789
0123456789

Friday, October 3, 2008

Identify errors in this below program, if any. Otherwise give the O/p

void main()
{
float a=1.1;
int x=1;
for(a=1.0; a<3.0; a++) {
switch(x)
{
default:
printf("its default\n");
case 1 :
printf("its 1\n");
x++;
continue;
case (1+1) :
printf("its 2\n");
break;
}
}
}

Sunday, September 28, 2008

Which one of the following statements will properly initialize the variable t with the current time from the above statement?

18. time_t t;

Choice a: t = clock();
Choice b: time( &t );
Choice c: t = ctime();
Choice d: t = localtime();
Choice e: None of the above

Friday, September 19, 2008

A compound statement is a group of statements included between a pair of

a. Double quote
b. Curly braces
c. Parenthesis
d. A pair of /’s

Thursday, September 18, 2008

What is the output of following programme ?

main( )
{
int a=30, b=40, x;
x=(a!=10) && (b=50);
printf(“x= %d”,x);
}

a. 10
b. 50
c. 1
d. 0

Sunday, September 14, 2008

"My salary was increased by 15%!"

Select the statement which will EXACTLY reproduce the line of text above.

Choice a: printf("\"My salary was increased by 15/%\!\"\n");
Choice b: printf("My salary was increased by 15%!\n");
Choice c: printf("My salary was increased by 15'%'!\n");
Choice d: printf("\"My salary was increased by 15%%!\"\n");
Choice e: printf("\"My salary was increased by 15'%'!\"\n");

Thursday, September 11, 2008

Which one of the following functions is the correct choice for moving blocks of binary data that are of arbitrary size and position in memory?

Choice a: memcpy()
Choice b: memset()
Choice c: strncpy()
Choice d : strcpy()
Choice e :memmove()

Monday, September 8, 2008

What is the output of following programme ?

int main()
{
int x = -10;
printf("%d\n", ~x+1);
return EXIT_SUCCESS:
}
a) -11
b) -9
c) 10
d) Size of the integer is required to find out the answer.

Wednesday, September 3, 2008

Whatz wrong with this !!! How can I rectify it.

int a = 20;
void main ()
{
Fun1();
}
Fun1()
{
Static int b = a;
}

Choice
a) declare ‘int a’ inside the Fun1()
b) Make the ‘int a’ as ‘const int a = 20;’
c) Its illegal initialization of static variable. Initialize with constatnts
d) Its illegal initialization of static variable. Initialize with address of a

Saturday, July 19, 2008

In C, a Union is

a. Memory location
b. Memory store
c. Memory screen
d. None of these

Thursday, June 19, 2008

A Link is

a. A compiler
b. An active debugger
c. A C interpreter
d. A analyzing tool in C

Monday, May 19, 2008

A Structure

a. Can be read as a single entity
b. Cannot be read as a single entity
c. Can be displayed as a single entity
d. Has member variables that cannot be read individually

Saturday, March 1, 2008

You want to compile an object file that will be used as a shared object library.

Given the scenario described above, which change does the compiler make?

Choice a: Heap memory is not allocated to the shared object file.
Choice b: Variables are located in a public namespace.
Choice c: Shared object variables are designated by preceding their names with the shared object filename to assure they are unique.
Choice d: The base memory address is not defined in the object file.
Choice e: The stack is cleared, so a stack size is not assumed.

Friday, January 25, 2008

The number of the relational operators in the C language is

a. Four
b. Six
c. Three
d. One
e. Eight