0
Alien head

programming languages Online Quiz - 142

Description: programming languages Online Quiz - 142
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

1)main() { printf(“%x”,-1<<4); }

  1. ffff

  2. fff0

  3. 0ff0

  4. 0fff


Correct Option: B

1)main() { int i = 0; for( ; i++ ; printf(“%d”,i)); printf(“%d”,i); }

  1. 0

  2. 1

  3. infinite loop

  4. 0 1


Correct Option: B

1)main() { int i = -1, j= -1, k=0, l=2, m; m=i++&&j++&&k++||l++; printf(“%d %d %d %d %d”,i,j,k,l,m); }

  1. -1 -1 0 2 0

  2. -1 -1 0 2 1

  3. 0 0 1 3 1

  4. 0 0 1 3 0


Correct Option: C

1)#define f(g,g2) g# #g2 main() { int var12 = 100; printf(“%d”,f(var,12)); }

  1. junk value

  2. 100

  3. 12

  4. none of these


Correct Option: B

1)main() { int i = 1, j = 2; switch(i) { case i: printf(“GOOD”); break; case j: printf(“BAD”); break; }; }

  1. GOOD

  2. BAD

  3. ERROR

  4. NONE OF THESE


Correct Option: C

main() { int i = 400, j = 300; printf(“%d %d”); } [in Turbo C complier]

  1. 400 300

  2. 300 400

  3. junk value

  4. error


Correct Option: A

#define a 10 main() { #define a 50 printf(“%d”,a); }

  1. 50

  2. 10

  3. error

  4. none of these


Correct Option: A

main() { printf(“\nab”); printf(“\bsi”); printf(“\rha”); }

  1. asiha

  2. hai

  3. aha

  4. siha


Correct Option: B

7) main() { float me=1.1; double you=1.1; if(me = = you) printf(“I love u”); else printf(“I hate you”); }

  1. I hate you

  2. I love your

  3. error

  4. will not compile


Correct Option: A

6) void abc(int a[]) { a++; a[1] = 612; } main() { char a[5]; abc(a); printf(“%d”,a[4]); }

  1. error

  2. arbitary value

  3. 612

  4. 100


Correct Option: D

5) void swap(int &, int &); void main() { int a=10, b=20; swap(a++,b++); printf(“\n%d\t%d\t”,a,b); } void swap(int &x, int &y) { x+=2; y+=3; }

  1. 11 21

  2. 13 24

  3. 10 20

  4. 12 23


Correct Option: A

main() { int *p1, i=25; void *p2; p1=&i; p2=&i; p1=p2; p2=p1; printf(“%d”,i); }

  1. error

  2. 25

  3. will not complie

  4. some memory address


Correct Option: B

3) void main() { int x=10; (x<0) ? (int a = 100) : (int a=1000); printf(“%d”,a); }

  1. 10

  2. 1000

  3. error

  4. none of this


Correct Option: C

2) void main() { unsigned char a; a = 0XFF + 1; printf(“%d”,a); }

  1. 255

  2. 256

  3. 0

  4. 1


Correct Option: C

#define T t void main() { char T=’T’; printf(“\n%c\t%c\n”,T,t); }

  1. t t

  2. t T

  3. T t

  4. T T


Correct Option: D

In the ENVIRONMENT DIVISION which paragrahs should a program (not a subroutine) have?

  1. ERROR RECOVERY

  2. ROLLBACK

  3. Any one of the above

  4. Both of the above


Correct Option: D

Which of the following set of statements is correct as per standards?

  1. MOVE 1 TO A.

  2. MOVE 1 TO A

  3. Both of the above.

  4. None of the above


Correct Option: B

All subscripts should be defined as PIC ____?

  1. NUMERIC

  2. BINARY

  3. ALPHANUMERIC

  4. ANY OF THE ABOVE


Correct Option: B

While reading a SDF file, if AT END clause is skipped,

  1. program will abort

  2. command will fail but last line will remain populated in the file- variables

  3. command will fail and file-variables will be blank

  4. the program will give a compile time error


Correct Option: D

Comments (Not remarks) should be in

  1. Upper case

  2. running text

  3. Any of above

  4. Not a part of standard.


Correct Option: B
+ View questions