0

programming languages Online Quiz - 44

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

#include main() { int a[2][2][2] = {{10,2,3,4},{5,6,7,8}}; int p,*q; p=&a[2][2][2]; *q=**a printf("%d----%d",*p,*q); }

  1. Compilation error

  2. syntax error

  3. 10 2 3 4 5 6 7 8

  4. print the address of pointer p and q


Correct Option: A

#include main (){ unsigned int a = 0xf0ad; char *c = (char *) &a; printf("value @c: %x",*c); }

  1. value @c: ffffffad

  2. value @c: 0xf0ad

  3. compilation error

  4. syntax error


Correct Option: A
  1. 23

  2. Prints some address

  3. Compilation error

  4. Run time error


Correct Option: C

#include main(){ int a=2; int *p=&a; print("%x\t",p); print("%x\t",*p++); print("%x\t",p); }

  1. someaddress value someaddress

  2. value value value

  3. syntax error

  4. compilation error


Correct Option: C
  1. Size of c: some value Addr of c:some address

  2. Size of c: some value Addr of c:some value

  3. Size of c: some address Addr of c:some address

  4. Compilation error


Correct Option: D

Can a variable be declared as both const and volatile

  1. True

  2. False


Correct Option: A
  1. for(int y : x) {

  2. for(x : int y) {

  3. int y = 0; for(y : x) {

  4. for(int y=0, z=0; z

  5. for(int y=0, int z=0; z

  6. int y = 0; for(int z=0; z


Correct Option: A,D,F

Given: 3. public class Circles { 4. public static void main(String[] args) { 5. int[] ia = {1,3,5,7,9}; 6. for(int x : ia) { 7. for(int j = 0; j < 3; j++) { 8. if(x > 4 && x < 8) continue; 9. System.out.print(" " + x); 10. if(j == 1) break; 11. continue; 12. } 13. continue; 14. } 15. } 16. }

  1. 1 3 9

  2. 5 5 7 7

  3. 1 3 3 9 9

  4. 1 1 3 3 9 9

  5. 1 1 1 3 3 3 9 9 9

  6. Compilation fails


Correct Option: D
  1. public class Wind { 4. public static void main(String[] args) { 5. foreach: 6. for(int j=0; j<5; j++) { 7. for(int k=0; k< 3; k++) { 8. System.out.print(" " + j); 9. if(j==3 && k==1) break foreach; 10. if(j==0 || j==2) break; 11. } 12. } 13. } 14. }
  1. 0 1 2 3

  2. 1 1 1 3 3

  3. 0 1 1 1 2 3 3

  4. 1 1 1 3 3 4 4 4

  5. 0 1 1 1 2 3 3 4 4 4

  6. compilation fails


Correct Option: C
- Hide questions