Objective C Debugging Questions and Answers Part 2 | URDINESH

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

Thursday, May 8, 2014

Objective C Debugging Questions and Answers Part 2

1)      Find  the output for the following program
#include<stdio.h>
main()
{
                  int y[4]=={6,7,8,9};
                  int *ptr=y+2;
                  printf(“%d\n”,ptr[1]);
}
(a) 6                 (b)7                  (c)8                  (d)9
            ANS :(d)9

2)      char txt[20]=”Helloworld!\0”.=;
How many bytes are allocated by the definition above?
 (a)11bytes      (b)12bytes       (c)13bytes       (d)20bytes
ANS :(d)20bytes

3)      What would be the output of the given program?
#include<stdio.h>
main()
{
            int x,y=10;
            x=y*NULL;
            printf(“%d”,x);
}
(a)Error            (b)0      (c)10    (d)Garbagevalue
ANS :(b)0

4)      Find the output for the given program.
#include<stdio.h>
main()
{
            int a=36,b=9;
            printf(“%d”,a>>a/b-2);
}
(a)9                  (b)7                  (c)5                  (d)None of these
ANS :(a)9

5)      What would be the output for the given program?
#include<stdio.h>
main()
{
            char far *s1,*s2;
            printf(“%d%d”,sizeof(s1),sizeof(s2));
}
(a)2,2               (b)4,4               (c)4,2               (d)Garbagevalue
ANS :(c)4,2

6)      Check out the answer for the given program.
#include<stdio.h>
main()
{
            extern int i;
            i=20;
            printf(“%d”,i);
}
(a)20    (b)Compile Error         (c)0      (d)Linker Error
ANS :(d)Linker Error

7)      What would be the output of the following program?
#include<stdio.h>
main()
{
            int i=-3,j=2,k=0,m;
            m=++i||++j&&k;
            printf(“\n%d%d%d%d”,i,j,k,m);
}
(a)-3,2,0,1        (b)-2,3,1,0       (c)-2,2,0,1                    (d)-4,3,1,1
ANS :(c)-2,2,0,1

8)      Find the output for the given program.
#include<stdio.h>
main()
{
            int a=10;
            printf(“%d”,printf(“%d”,a));
}
(a)Error            (b)10    (c)1010            (d)102
ANS :(d)102

9)      Find the output for the given program.
#include<stdio.h>
main()
{
            Printf(“%f”,log(36.0));
}
 (a)36.0            (b)Compile Error         (c)0.000                       (d)Linking Error
ANS :(c)0.000

10)  Find the answer for the following program.
#include<iostream.h>
void main()
{
            char p[]=”\n”;
            p[1]=’c’;
            cout.<<p,65;
            getch();
}                     
 (a)A                (b)C                 (c)65                (d)Error
ANS :(b)C

11)  Find out the output for the given program.
#include<stdio.h>
void main()
{
            int a=10,b=20;
            char x=1,y=0;
            if(a,b,x,y)
            {
                        printf(“EXAM”);
            }
}
(a)XAM          (b)EXAM        (c)Compile Error         (d)None of these
ANS :(c)Compile Error

12)  What would be the output for the following program?
#include<stdio.h>
char *myfun(char *ptr)
{
            ptr+=3;
            return(ptr);
}
int main()
{
            char *x,*y;
            y=”HELLO”;
            y=myfun(x);
            printf(“y=%s\n”,y);
            return 0;
}
(a)Y=HELLO             (b)Compile Error         (c)Linking Error          (d)No output
ANS :(b)Compile Error

13)  Find the output for the following program.
#include<iostream.h>
main()
{
            register i=5;
            char j[]=”hello”;
            cout<<j<<i;
}
 (a)hello5                     (b)Error           (c)Runtime Error                     (d)hello
ANS :(a)hello5

14)  Find the output of the following  program.
#include<stdio.h>
main()
{
            int arr[]={12,13,14,15,16};
            printf(“%d%d%d”,sizeof(arr),sizeof(*arr),sizeof(arr[0]));
}          
(a)4,1002,12                (b)10,1002,2    (c)10,2,2          (d)Error
ANS:(c)10,2,2

15)  What would be the output for the following program?
#inlcude<stdio.h>
void main()
{
int const *p=5;
printf(“%d”,++(*p));
}
(a)5                  (b)6                  (c)3275                        (d)Compiler Error
ANS :(d)Compile Error

16)  What would be the output for the following program?
#include<iostream.h>
int main()
{
            int i=3,j=5;
            cout<<(i+j)++;
            return 0;
}
(a)8                  (b)9      (c)Compile Error         (d)No output
ANS :(c)Compile Error

17)  What function will read  a specified number of elements from a file?
(a)fileread ()                (b)getline()                  (c)fread()                     (d)getread()
ANS :(c)fread()

18)  Find the output of the following  program.
#include<stdio.h>
main()
{
            char str[]=”S/065AB”;
            printf(“\n%d”,sizeof(str));
}
(a)7                  (b)6                  (c)5                  (d)Error
ANS :(c)5

19)  What would be the output for the given program?
#include <fstream.h>
void main () 
{
               ifstream f1;
         ofstream f2;
         f1.open("scores.96");
         f2.open("final.96");
               int s1, s2, s3;
         float w1, w2, w3;
               f1 >> s1 >> w1;
               f1 >> s2 >> w2;
               f1 >> s3 >> w3;
               f2 << (s1*w1+s2*w2+s3*w3);
       }
(a)    Abnormal Termination  (b)Floating point error (c)Both 'a' and 'c' (d)None
     ANS :(c)Both ‘a’ and ‘c’

20)  What is the output of the following program?
#include<stdio.h>
main()
{
            int a=10;
            printf(“%d&i”a,10);
}
(a)Error                        (b)10                (c)1010                        (d)None of these
ANS :(d)None of these

21)  What would be the output of the following program?
#include<stdio.h>
main()
{
            int x[4]={1,2,3};
            printf(“%d%d%D”,x[3],x[2],x[1]);
}
(a)03%D          (b)000              (c)032              (d)321
ANS :(a)03%D

22)  Find the output for the given program.
#include<stdio.h>
main()
{
            printf(3+”goodbye”);
}
(a)goodbye      (b)dbye            (c)odbye          (d)3goodbye
ANS :(b)dbye

23)  What would be the output of the given program?
#include<stdio.h>
main()
{
            int i,j
            for(i=0;i<=10;i++)
            {
                        j+=5;
                        assert(i<5);
            }
}
(a)Linking Error          (b)Compiler Error        (c)No output   (d)Runtime Error
ANS :(a)Linking Error

24)  Find the output for the given program.
#include <iostream.h>
typedef int Bool;
const Bool TRUE = 1;
const Bool FALSE = 0;
void main() 
{
                int zero = 0;
  int two = 2;
  int three = 3;
  cout << (FALSE && (1/zero == 5)) << endl;
  cout << ((1/zero == 5) && FALSE) << endl;
  cout << ((1/zero == 5) && (two == three)) << endl;
}
 
(a)TRUE     (b)FALSE   (c)Divide Error   (d)none
ANS :(c)Divide Error

25)  What would be the output for the given program?
#include<stdio.h>
#include<conio.h>
main()
            {
                        clrscr();
                        printf(“%d\n”,clrscr());
}
(a)Error            (b)100  (c)Compiler Error        (d)Infinite Loop
ANS :(b)100

26)  Check out the answer for the given program.
#include<stdio.h>
main()
{
            int counter=40;
            for(;counter;)
            counter--;
            printf(“%d\n”,counter);          
}
(a)40                (b)-40              (c)0                  (d)Error
ANS :(c)0

27)  What would be the output of the following program?
#include<stdio.h>
main()
{
            main();
}
(a)Compile Error     (b)Empty Screen       (c)Runtime Error       (d)Garbagevalue
ANS :(c)Runtime Error

28)  Find the output for the given program.
#include<stdio.h>
void main()
{
            int i=5;
            printf(“%d”,i+++++i);
}
(a)5+5              (b)5+++++5                (c)No output               (d)Error
ANS :(c)No output

29)  Find the output for the given program.
#include<stdio.h>
main()
{
            printf(“%d”,out);
}
int out=100;
 (a)out              (b)100              (c)Compile Error                     (d)None of these
ANS :(c)Compile Error

30)  Find the answer for the following program.
#include<stdio.h>
 main()
{
                        long int a=scanf(“%ld%ld”,&a,&a);
                        printf(“%ld”,a);
}
(a)Error            (b)Garbagevalue          (c)0                  (d)2

ANS :(d)2





                 *******Thank you for reading and All the best**************

Your comments will help me a lot...please give your comments which will encourage me to post more.....

No comments:

Post a Comment

Thanks for your valuable comments

Followers