Programming Languages: C, Java, .NET/WCF & Regex

Test your knowledge across multiple programming languages including C, Java, .NET/WCF framework, and regular expressions

20 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

What will the output of: Regex.Replace("01/02/03","([0-9]+)/([0-9]+)/([0-9]+)","$2/$1/$3");

  1. Exception
  2. 02/01/03
  3. 03/02/01
  4. 01/02/03
Question 2 Multiple Choice (Multiple Answers)

Which regular expression matches email address [email protected]?

  1. \w+@\w+.[\w]{3}
  2. ^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+-+)|([A-Za-z0-9]+.+)|([A-Za-z0-9]+++))[A-Za-z0-9]+@((\w+-+)|(\w+.))\w{1,63}.[a-zA-Z]{2,6}
  3. [\w.-][a-zA-Z0-9_]@[\w.-][a-zA-Z0-9].[a-zA-Z][a-zA-Z.]*[a-zA-Z]
  4. All of above
Question 3 Multiple Choice (Multiple Answers)

Whch of the following is used as word boundary in Regular Expression?

  1. ^
  2. B
  3. b
  4. $
Question 4 Multiple Choice (Single Answer)

Where we can host WCF service?

  1. Windows service
  2. WAS
  3. None of above
  4. Both 1 and 2
Question 5 True/False

WSHttpBinding uses SOAP 1.1.

  1. True
  2. False
Question 6 Multiple Choice (Single Answer)

What is the new activity available in .Net 3.5 for windows workflow which is used to expose workflow as service.

  1. Send Activity
  2. Web Service Input Activity
  3. Receive Activity
  4. None of These
Question 7 Multiple Choice (Multiple Answers)

What are the various contracts available in WCF.

  1. Service contract
  2. Operation contract
  3. Method contract
  4. Data Member Contract
  5. Message Contract
  6. Fault Contract
Question 8 True/False

WCF have binding to support MSMQ.

  1. True
  2. False
Question 9 Multiple Choice (Single Answer)

What is the output ? main() { int i=8; printf("%d%d%d%d", i, i++, ++i, i); }

  1. 881010
  2. 89910
  3. 891010
  4. 10998
Question 10 Multiple Choice (Single Answer)

What is the output of the following C program? main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

  1. 5 7
  2. 4 7
  3. 5 1
  4. 4 1
Question 11 Multiple Choice (Single Answer)

What is the output of the following program ? main() { float a=1.1; double b=1.1; if (a==b) printf("Hai"); else printf("Hello"); }

  1. Compilation error-Type mismatch
  2. Hai
  3. Hello
  4. Run time error
Question 12 Multiple Choice (Single Answer)

What is the output of the following program ? main() { int a=10; { int a=100; { int a=1000; printf("%d", a); } printf("%d", a); } printf("%d", a); }

  1. 100010001000
  2. 100010010
  3. 101001000
  4. 010010001
Question 13 Multiple Choice (Single Answer)

What is the output ?main(){ int i; for(i=0;i<10;i++); printf("%d", i); }

  1. 10
  2. 11
  3. Compilation error-Null can not be there after for
  4. Infinite loop
Question 14 Multiple Choice (Single Answer)

main() { int i=20, *k; k=&i; printf("\n%d %d", i, k); ++*k; printf("\n%d %d", i, k); (*k)++; printf("\n%d %d", i, k); } Let the output of first print statement is 20 1000. What is the output of 2nd and third print statements ?

  1. 21 1000 21 1002
  2. 21 1000 Garbage_value 1002
  3. 21 1000 22 1002
  4. 21 1000 22 1000
Question 15 Multiple Choice (Single Answer)

What is the output ? main() { int x=2000, *p, y = 200; p = &y; x = x/*p; printf("%d", x); }

  1. 10
  2. Garbage value
  3. 100
  4. Compilation error
Question 16 Multiple Choice (Single Answer)

What is the output ?main(){ int a[5]={1,2,3,4,5}; a[7] = 23; printf("%d", a[7]);}

  1. 23
  2. Garbage Value
  3. 0
  4. Compilation-Array out of boundary
Question 17 Multiple Choice (Single Answer)

main(){ int i=5; char c; scanf ("%d", &c); printf("Here"); printf ("%d ", i);}For scanf in standard input the input is given as 63. then what will be displayed in the standard output ?

  1. 63 Here5
  2. 3 Here5
  3. 63 Here0
  4. 3 Here0
Question 18 Multiple Choice (Single Answer)
  1. public class Test { 2. public static void main(String args[]) { 3. class Foo { 4. public int i = 3; 5. } 6. Object o = (Object)new Foo(); 7. Foo foo = (Foo)o; 8. System.out.println(“i = “ + foo.i); 9. } 10. } What is the result?
  1. i = 3
  2. Compilation fails.
  3. A ClassCastException is thrown at line 6.
  4. A ClassCastException is thrown at line 7.
Question 19 Multiple Choice (Single Answer)

Which one cause a compiler error? (Choose two) a. float f2[] = new float[]; b. float[] f1 = new float[3]; c. float f3[] = new float[3]; d. float f4[] = new float[] { 1.0f, 2.0f, 3.0f};

  1. c
  2. a
  3. b
  4. d
Question 20 Multiple Choice (Single Answer)
  1. int i =1,j =10; 12. do { 13. if(i++> --j) { 14. continue; 15. } 16. } while (i <5); 17. System.out.println(“i = “ +i+ “and j = “+j); What is the result?
  1. i = 6 and j = 5
  2. i = 5 and j = 6
  3. i = 5 and j = 5
  4. i = 6 and j = 6