C#, Perl, and Java Programming Fundamentals
Test your knowledge across multiple programming languages including C#/.NET concepts, Perl syntax and file operations, and Java exception handling.
Questions
public class Sample{ public static void main(String[] args){ int i=5; if(i==5) throw new ArithmeticException("i is 5"); System.out.println(i); } } Does the code compiles fine?
- True
- False
assertions can force which of the constraints ......
- pre conditions
- post conditions
- exceptions
- class invariants
The following will result in which of the following, if the prize is currently "10 Euros" print 'You won $prize';
- You won $5.00
- You won 5 dollars
- You won $prize
- You won $5
Which of these is NOT a standard output command:
- printf
- print
- type
- write
The function to a delete file is
- untie
- delete
- unlink
- rm
Output of the following:s/(\w)/\u$1/g;
- Changes all lower case letters in the string stored in the variable $_ to upper case
- Changes the first letter in the string stored in the variable $_ to upper case
- Changes all letters in the string stored in the most recently used scalar variable to upper case
- adds \u in front of every letter or digit in the string in $_
Which of these is a valid regular expression meaning "contains any digit"?
- /[1-9]/
- /^\d+$/
- /^\d+/
- m-\d-
open (INPUT,"<inpput.txt"); while(){ print $_; } How many times will the file get printed?
- once
- twice
- the program will go on into infinite loop
- None of the above
Which of the following is a valid scalar variable name?
- $section_32B
- $baby-boy
- $401k
- $tic#tac#toe
Code 1: Code: my @lines = grep /^hi/, @allLines; Code 2: Code: my @lines = (); foreach (@allLines) { push (@lines,$_) if (/^hi/); } What is the difference between the two snippets (Code 1 and Code 2) above?
- In code 1, the operation occurs in one command; code 2 iterates each element in the array for matches.
- In code 1, the elements of @lines are the indexes in @allLines, in which matches were found.
- In code 1, the elements of "@lines" begin with the index in "@allLines", in which the match was found.
- In code 1, "@lines" may not necessarily be in the same order; the original lines appear in "@allLines".
What type of variable is INPUT?
- A File Handle
- A List
- A Code variable
- A Tyleglob
For a time in the month of March, the localtime function will return a month of:
- 2
- 3
- Mar
- March
The following will result in which of the following, if the prize is currently "10 dollars" print 'You won $prize';
- You won $10.00
- You won 10 dollars
- You won $prize
- You won $10
Which of these is not a method of DateTime object?
- AddTick()
- GetMonth()
- GetHashCode()
- AddMilliSeconds()
- All the Above
Which of these is a value Type?
- Arrays
- Strings
- Enums
- None
- All the Above
In Which of these types do we store the difference between two dates?
- String
- Type
- TimeSpan
- int
- None
CTS is contained in –
- Common Language Specification
- Common Language Runtime
- Base Class Library
- None
- All the Above
Which Class in C# helps to compile a .cs file into .dll file programmatically ?
- System.Globalization
- System.Diagnostics
- CsharpCodeProvider
- IcodeCompiler
- All the Above
MSIL stands for –
- Managed Software Intermediate Language
- Managed Software InterUsable Language
- MicroSoft Intermediate Language
- Machine Source Intermediate Language
- None
How to supress the COPYRIGHT statement issued while compiling a particular .cs file through command line
- /noconfig
- /nologo
- /out
- None
- All the Above