79
Computer Skills Lab (IT0324) Test Paper-1 (C Quiz) 1. The C language has been developed by A. Patrick Naughton B. Ken Thompson C. Dennis Ritchie D. Martin Richards 2. What will be output if you will execute following c code? #include<stdio.h> int main () { int num, a=5; num= -a--; printf ( “%d %d” , num,a); return 0; } A. 5 4 B. -4 4 C. -5 4 D. -4 5 3. What will be output if you will execute following c code? main() { clrscr (); printf (“ Result = %d”,2==3 ? 4:5 ); } A. 10 B. 7 C. 5 D. 3 4. What will be output if you will execute following c code? main() { int a,z,x=10, y=20; clrscr (); 1

Computer Skills

Embed Size (px)

DESCRIPTION

Computer skills

Citation preview

Computer Skills Lab (IT0324)Test Paper-1 (C Quiz)

1. The C language has been developed by A. Patrick NaughtonB. Ken Thompson C. Dennis RitchieD. Martin Richards

2. What will be output if you will execute following c code?#includeint main () {int num, a=5;num= -a--;printf ( %d %d , num,a);return 0;}A. 5 4B. -4 4C. -5 4D. -4 5

3. What will be output if you will execute following c code?main(){clrscr ();printf ( Result = %d,2==3 ? 4:5 );}A. 10B. 7C. 5D. 3

4. What will be output if you will execute following c code?main(){int a,z,x=10, y=20;clrscr ();z=x*y++;a=x*y;printf (\n%d %d,z,a);}A. 1020B. 1000 2000C. 200 210D. 2000 2100

5. What will be output if you will execute following C code?void main (){int m,j=3,k;m=2*j/2;k=2*(j/2);clrscr ();printf (\n m=%d k=%d,m,k);}A. m=3 k=2B. m=3 k=3C. m=2 k=3D. m=2 k=2

6. What will be the value of x after the execution of following code?void main(){ int x=! 0*10;}A. 10B. 1C. 0D. None of these

7. What will be the value of k after the execution of following code?void main(){int k=8;(k++-k++);}A. 10B. 0C. -1D. 9

8. What will be the value of b after the execution of following code?void main(){

A. 11B. 12C. 7D. 9

9. What will be the output of the following code?void main(){int y=65;clrscr ();printf(%c %d,y,y);return 0;}A. 65B. 97C. ErrorD. -97

10. What will be the output of the following code?void main(){int a=2; a=4:printf (%d,a);}A. 2B. 4C. 6D. 8

11. What will be the value of x after execution of the following program?void main(){int x,*p;p=&x;*p=2;clrscr ();printf ( \n Value of x=%d,x);}A. 0B. 2C. 65504D. None of these

12. What will be the value of variable a1 and a2 after execution?void main() int a1,a2,c=3,*pt;pt=&c;a1=3*(c+5);a2=3*(*pt+5);}A. 24 24B. 12 24C. 24 12D. None of these.

13. What will be the output of following code-main (){int a=20, b=35;a=b++ +a++;b=++b + ++a;printf (%d%d\n,a,b);A. 5432B. 5794C. 2435D. 3456

14. What will be the output of following code-void main()char arr= NETWORK;printf(%s, arr);

A. NetworkB. NC. Garbage ValueD. Complication Error

15. What will be the output of following code-void main()char arr= THE AFRICAN QUEEN;printf(%s, arr);

A. THE AFRCIAN QUEENB. THE AFRICANC. ErrorD. None

16. What will be the output of following code-void main()const int *p;int a=10;p=&a;printf(%d,*p);return 0;}A. 0B. 10C. Garbage ValueD. Any memory address

17. What will be the output of following code-int main()int a=5 , b=10, c;int *p=&a , *q=&b;c=p-q;printf(%d,c);return 0;}A. 1B. 5C. -5D. Complication Error

18. What will be the output of following code-void main()int a=2, b=7, c=10;c=a==b;printf(%d,c);return 0;}A. 1B. 0C. Garbage valueD. Error

19. What will be the output of following code-void main()void (*p)();int (*q)();int(*r)();p=clrscr();q=getch();r=puts();(*p)();(*r)(cquestionbank.blogspot.com);(*q)();return 0;}A. NullB. Cquestionbank.blogspot.comC. CD. Error

20. What will be the output of following code-Printf(%c,65);Printf(%d,65);A. 65B. 0C. 1D. Error

21. What will be the output of following code-void main(){int a=5, b=6, c=11;clrscr();printf(%d %d %d);getch();}A. Garbage value garbage value garbage valueB. 5 6 11C. 6 5 11D. Compiler error

22. What will be the output of following code-main(){int i=3;switch(i);{Default:printf(zero);Case 1: printf(one)Break;Case 2: printf(two);Break;Case 3: printf(three);}}A. 0B. 1C. 2D. 3

23. void main()int i=320;Char *ptr=(char *) &i;Printf(%d,*ptr);}A. 320B. 1C. 64D. Error

24. Which one Keyword used to calling function back again and again? A. switchB. gotoC. go backD. return

25. #includemain (){int x,y = 10;x = y * NULL;printf("%d",x);}What is the output of above code?A. errorB. 0C. 10D. garbage value

ANSWERS OF TEST PAPER 1

1. C2. C3. C4. C5. A6. A7. C8. A9. A10. B11. B12. A13. B14. C15. D16. C17. A18. B19. B20. A21. C22. D23. C24. D25. B

Computer Skills Lab (IT0324)Test Paper-2 (C++ Quiz)

1. Which of the following statements is correct?A. Base class pointer cannot point to derived class.B. Derived class pointer cannot point to base class.C. Pointer to derived class cannot be created.D. Pointer to base class cannot be created.

2. Which of the following concepts means determining at runtime what method to invoke?A. Data hidingB. Dynamic TypingC. Dynamic bindingD. Dynamic loading

3. Which of the following statements is correct? Once a reference variable has been defined to refer to a particular variable it can refer to any other variable. A reference is not a constant pointer.A. Only 1 is correct.B. Only 2 is correct.C. Both 1 and 2 are correct.D. Both 1 and 2 are incorrect.

4. If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access.

A. Protected and public data only in C and B.B. Protected and public data only in C.C. Private data in A and B.D. Protected data in A and B.

5. To perform stream I/O with disk files in C++, you should

A. open and close files as in procedural languages.B. use classes derived from ios.C. use C language library functions to read and write data.D. include the IOSTREAM.H header file

6. What is the output of the following codechar symbol[3]={a,b,c};for (int index=0; index100) cout