Welcome to Your Quiz: Aptitude test C Programming IBM

Name Email
1. 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");
}
2. Do you find any issue with the above snippet of code?
3. In a class, except 18 all are above 50 years. 15 are below 50 years of age. How many people are there
4. The precedence of arithmetic operators is (from highest to lowest)
5. What is the output of this C code?
#include
int main()
{
int i = 5;
i = i / 3;
printf(“%d\n”, i);
return 0;
}
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?
7. Write a function to swaps the values of two integers.
8. 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);
}
}
9. 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//
10. 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
11. Which of the following will initialize the new memory to 0 ?
12. Which of the following API is used to hide a window
13. 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”);
}
14. The UNIX shell ....
15. Suppose that in a C program snippet, followings statements are used.
i) sizeof(int);
ii) sizeof(int*);
iii) sizeof(int**);
16. Can we have a pointer to a function?
17. What will the statement char ch=’A’  store in variable ch?
18. 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;
}
19.

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

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

Thank You for Submitting your response for Quiz

Aptitude test C Programming IBM

Please click on View Result Button to see the Result.



(Visited 11 times, 1 visits today)