Welcome to Your Quiz: Aptitude test C Programming IBM

Name Email
1.

The precedence of arithmetic operators is (from highest to lowest)

(Visited 12 times, 1 visits today)
2.

What is the output of this C code?
#include
int main()
{
printf(“nn /n/n nn/n”);
return 0;
}

(Visited 12 times, 1 visits today)
3.

Write a function to swaps the values of two integers.

(Visited 12 times, 1 visits today)
4.

What will be output if you will compile and execute the following c code?
#include
#define message “union is\
power of c”
int main()
{
printf(“%s”,message);
return 0;
}

(Visited 12 times, 1 visits today)
5.

Do you find any issue with the above snippet of code?

(Visited 12 times, 1 visits today)
6.

Let x be an integer which can take a value of 0 or 1. The statement if(x = =0) x = 1; else x = 0; is equivalent to which one of the following?

(Visited 12 times, 1 visits today)
7.

Output of the following program is
void main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
Break;
}
printf("%d,",i);
}
}

(Visited 12 times, 1 visits today)
8.

Can we have a pointer to a function?

(Visited 12 times, 1 visits today)
9.

Which of the following will initialize the new memory to 0 ?

(Visited 12 times, 1 visits today)
10.

What is the output in the following program
main()
{
char c=-64;
int i=-32 ;
unsigned int u =-16;
if(c>i)
{
printf("pass1,");
if(c<u)
printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1);
if(i<u)
printf("pass2");
else
printf("Fail2");
}

(Visited 12 times, 1 visits today)
11.

Which of the following API is used to hide a window

(Visited 12 times, 1 visits today)
12.

In the context of C data types, which of the following is correct?

(Visited 12 times, 1 visits today)
13.

What is the output of this C code?
#include
int main()
{
int i = 5;
i = i / 3;
printf(“%d\n”, i);
return 0;
}

(Visited 12 times, 1 visits today)
14.

Suppose that in a C program snippet, followings statements are used.
i) sizeof(int);
ii) sizeof(int*);
iii) sizeof(int**);

(Visited 12 times, 1 visits today)
15.

In A,B,C are having some marbles with each of them.
A has given B and C the same number of marbles each of them already have.
Then, B gave C and A the same number of marbles they already have.
Then C gave A and B the same number of marbles they already have.
At the end A,B,and C have equal number of marbles.
(i) If x,y,z are the marbles initially with A,B,C respectively.
Then the number of marbles B have at the end

(Visited 12 times, 1 visits today)
16.

In the following code segment what will be the result of the function, value of x, value of y
{
unsigned int x=-1;
Int y;
y=~0;
if(x == y)
printf(“same”);
Else
printf(“not same”);
}

(Visited 12 times, 1 visits today)
17.

The UNIX shell ….

(Visited 12 times, 1 visits today)
18.

What will the statement char ch=’A’  store in variable ch?

(Visited 12 times, 1 visits today)
19.

In a class, except 18 all are above 50 years. 15 are below 50 years of age. How many people are there

(Visited 12 times, 1 visits today)
20.

What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9// p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//

(Visited 12 times, 1 visits today)

Thank You for Submitting your response for Quiz

Aptitude test C Programming IBM

Please click on View Result Button to see the Result.



(Visited 12 times, 1 visits today)
Show Buttons
Hide Buttons