Odesk C Programming test

Test : C Programming

Total time 40 minutes and total questions 40. You will retake the test after one month from the day you complete the test first time. But one thing you should remember that Odesk changes the 50% of question in every month.

1. Which of the following code(s) generate compile error
a) int n=5; x; x=n++;
b) int n=5; x; x=++n++
c) int n=5; x; x=(n+1)++
d) int n=5, x=6; x=(n+x)++
e) non of the above

2. Which is/are not storage Type
a) auto
b) global
c) static
d) resister
e) extern
 3. What will be the out put of the following program
void func()
{
static int i=1;
int j=1;
i++;
j++;
printf("%d%d", i,j);
}
void main()
{
func();
func();
func();
}
a) 222222
b) 232323
c) 234234
d) 223242
e) none of the above

4. Break is used in early exit
a) switch
b) for
c) while
d) do while
e) all

5. What will be the out put of the C program

char *str[]={"MANOJ", "KUMAR", "CHOUDHRY"};
printf("\n string 1=%s", str[0]);
printf("\n string 2=%s", str[1]);
printf("\n string 3=%s", str[3]);

a) MANOJ KUMAR CHOUDHRY
b) MAN
c) KUM
d) DHRY
e) non of the above

6. What will be the out put

#include "stdio.h"
main()
{
int n=5;
assert(n>3);
n=n+2;
assert(n>7)
return (0);
}
a) Error in line assert(n>3)
b) error in line n=n+2
c) error in line n>7
d) error in line return(0)

7. Which can be causes loss of the data

a)      int i;
        char c;
          i=c;
           c=i;
b)      int i;
         char c;
         c=i;
         i=c;
c)   int i;
      float f;
      i=f;
       f=i;
d) all codes are right

8. What will be the out put
void main()
{
char arr1[]="REGALIMT";
char *arr2;
arr2=arr1;
printf("%d",sizeof(arr1));
printf("%d",sizeof(arr2));
}
a) 1,1
b) 9,8
c) 8,8
d) 8,9

9.What will be the output
main()
{
char *massg="asdfgh";
*massg++;
printf("%s", massg);
return(0);
}
a) asdfgh
b) sdfgh
c) dfgh
d) asdfg
e) none of the above.

10. Which is/are not relational operator
a) == b) != c) <> d) >= e) <=

11. Which memory allocation system allocating the memory and initialize the element to 0 (zero)
a) calloc();
b) malloc();
c) gets();
d) getch();
e) scanf();

12. Which is not a file related function
a) fgetc()
b) puts()
c) fputs()
d) malloc()

13. In order to read symmetrical record which function should used
a) fscanf()
b) fread()
c) fgets()
d) fgetc()
e) fseek()  
 
14. isalpha(), islower() a part of
a) stdio.h
b) dos.h
c) string.h
d) ctype.h
f) none of the above

15. Which memory function is used to free the memory, when the memory is allocated by malloc()
a) calloc()
b) remove()
c) delete()
d) del()
e) free()

1 comment:

  1. More Answer- http://magictunebd.blogspot.com/2012/06/odesk-wordpress-test-answer.html

    ReplyDelete