Programming Languages: C, Java, .NET/WCF & Regex
Test your knowledge across multiple programming languages including C, Java, .NET/WCF framework, and regular expressions
Questions
What will the output of: Regex.Replace("01/02/03","([0-9]+)/([0-9]+)/([0-9]+)","$2/$1/$3");
- Exception
- 02/01/03
- 03/02/01
- 01/02/03
Which regular expression matches email address [email protected]?
- \w+@\w+.[\w]{3}
- ^(([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}
- [\w.-][a-zA-Z0-9_]@[\w.-][a-zA-Z0-9].[a-zA-Z][a-zA-Z.]*[a-zA-Z]
- All of above
Whch of the following is used as word boundary in Regular Expression?
- ^
- B
- b
- $
Where we can host WCF service?
- Windows service
- WAS
- None of above
- Both 1 and 2
WSHttpBinding uses SOAP 1.1.
- True
- False
What is the new activity available in .Net 3.5 for windows workflow which is used to expose workflow as service.
- Send Activity
- Web Service Input Activity
- Receive Activity
- None of These
What are the various contracts available in WCF.
- Service contract
- Operation contract
- Method contract
- Data Member Contract
- Message Contract
- Fault Contract
WCF have binding to support MSMQ.
- True
- False
What is the output ? main() { int i=8; printf("%d%d%d%d", i, i++, ++i, i); }
- 881010
- 89910
- 891010
- 10998
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); }
- 5 7
- 4 7
- 5 1
- 4 1
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"); }
- Compilation error-Type mismatch
- Hai
- Hello
- Run time error
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); }
- 100010001000
- 100010010
- 101001000
- 010010001
What is the output ?main(){ int i; for(i=0;i<10;i++); printf("%d", i); }
- 10
- 11
- Compilation error-Null can not be there after for
- Infinite loop
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 ?
- 21 1000 21 1002
- 21 1000 Garbage_value 1002
- 21 1000 22 1002
- 21 1000 22 1000
What is the output ? main() { int x=2000, *p, y = 200; p = &y; x = x/*p; printf("%d", x); }
- 10
- Garbage value
- 100
- Compilation error
What is the output ?main(){ int a[5]={1,2,3,4,5}; a[7] = 23; printf("%d", a[7]);}
- 23
- Garbage Value
- 0
- Compilation-Array out of boundary
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 ?
- 63 Here5
- 3 Here5
- 63 Here0
- 3 Here0
- 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?
- i = 3
- Compilation fails.
- A ClassCastException is thrown at line 6.
- A ClassCastException is thrown at line 7.
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};
- c
- a
- b
- d
- 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?
- i = 6 and j = 5
- i = 5 and j = 6
- i = 5 and j = 5
- i = 6 and j = 6