Showing posts with label Programming Quiz. Show all posts
Showing posts with label Programming Quiz. Show all posts

Wednesday, 21 January 2015

Programming Quiz-80


If a program file sample.c is compiled on Linux/Unix platform what will be default name of executable file?

a) sample.exe
b) a.out
c) sample.bin
d) sample.obj

Answer: B

Programming Quiz-79


Testing of a program is done to ensure that it

a) should not contain any syntax error
b) performs its intended task
c) compiles successfully
d) should not run infinitely

Answer: B

Programming Quiz-78


The term bug refers to

a) Syntax Error
b) Logical Error
c) Runtime Error
d) All of above

Answer: D

Programming Quiz-77

Find the odd term

a) Source Code
b) Object Code
c) Executable Code
d) ASCII Code

Answer: D

Programming Quiz-76

The Acronym ANSI stands for _______________

a) American National Standards International
b) American National Software Incorporation
c) American National Standards Institute
d) American National Standards Instructions

Answer: C

Sunday, 4 January 2015

Programming Quiz-74



main()
{
signed int bit=512, mBit;

{
mBit = ~bit;
bit = bit & ~bit ;

printf("%d %d", bit, mBit);
}
}

a. 0, 0
b. 0, 513
c. 512, 0
d. 0, -513 


Answer: D

Programming Quiz-73


main()
{
if ((1||0) && (0||1))
{
printf("OK I am done");
}
else
{
printf(“OK I am gone”); }
}

a. OK I am done
b. OK I am gone
c. compile error
d. none of the above 


Answer:  A

Programming Quiz-72



main()
{
if (!(1&&0))
{
printf("OK I am done.");
}
else
{
printf(“OK I am gone.”); }
}

a. OK I am done
b. OK I am gone
c. compile error
d. none of the above 


Answer: A

Programming Quiz-71



main()
{
signed int bit=512, i=5;

for(;i;i--)
{
printf("%d\n", bit >> (i - (i -1)));
}
}

a. 512, 256, 0, 0, 0
b. 256, 256, 0, 0, 0
c. 512, 512, 512, 512, 512
d. 256, 256, 256, 256, 256 


Answer: D

Programming Quiz-70



main()
{
signed int bit=512, i=5;

for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
 

a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4
  

Answer: B

Programming Quiz-69



main()
   {
   int i;
   for(i=0;i<5;i++)
    {
    printf("%d\n", 1L << i);
   }
 }
 

a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16 


Answer: D

Programming Quiz-68



main()
{
  unsigned int bit=256;
  printf(“%d”, bit); }
   {
  unsigned int bit=512;
  printf(“%d”, bit); }
}

a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error 


Answer: D

Programming Quiz-67



main()
  {
  int x=5;
  for(;x!=0;x--) {
  printf(“%d\n”, x--); }
  }
 

a. 5, 4, 3, 2,1
b. 4, 3, 2, 1, 0
c. 5, 3, 1
d. none of the above 


Answer: C

Programming Quiz-66



main()
  {
  int x=5;
  for(;x==0;x--) {
  printf(“x=%d\n”, x--); }
 }



 

a. 4, 3, 2, 1, 0
b. 1, 2, 3, 4, 5
c. 0, 1, 2, 3, 4
d. none of the above 


Answer: D

Programming Quiz-65


main()
  {
   int i =10, j = 20;
   printf("%d, %d\n", j-- , --i);
   printf("%d, %d\n", j++ , ++i);
  }

a. 20, 10, 20, 10
b. 20, 9, 20, 10
c. 20, 9, 19, 10
d. 19, 9, 20, 10 


Answer: C

Programming Quiz-64


void main ()
  {
  int x = 10;
  printf ("x = %d, y = %d", x,--x++);
 }

a. 10, 10
b. 10, 9
c. 10, 11
d. none of the above 


Answer: D

Programming Quiz-63


main()
  {
   char c;
   int i = 456;
   c = i;
   printf("%d", c);
 }

a. 456
b. -456
c. random number
d. none of the above 


Answer: C

Programming Quiz-62



main()
{
  int c = 5;
  printf("%d", main|c);
}

a. 1
b. 5
c. 0
d. none of the above 


Answer: D

Programming Quiz-61


void func1(int (*a)[10])
{
printf("Ok it works");
}

void func2(int a[][10])
{
  printf("Will this work?");
}

main()
{
  int a[10][10];
  func1(a);
  func2(a);
}

a. “Ok it works” 

b. “Will this work?” 
c. “Ok it works Will this work?” 
d. None of the above 

Answer : C

Programming Quiz-60


main()
{
  char *a = "Hello ";
  char *b = "World";
  printf("%s", strcpy(a,b));
}

a. “Hello” 

b. “Hello World” 
c. “HelloWorld” 
d. None of the above 

Answer: D