0
Alien head

programming languages Online Quiz - 150

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

Which of the following commands will turn a scalar ($str)into an array of characters?

  1. @a = split($str).

  2. @a = split(/\s/, $str).

  3. This task can be done in Perl but none of the above commands do it.

  4. @a = split(/./, $str).


Correct Option: C

The value of the expression $yards += 10

  1. is 10

  2. is true.

  3. cannot be determined from the information given.

  4. relies on which command line arguments were used.


Correct Option: C

What is Perl?

  1. Practical Extraction and Report Language

  2. Practice for Exclusive and Report Language

  3. Practical Extraction and Report Learning

  4. Practical Exclusive and Report Language


Correct Option: A

The $_ variable

  1. holds the last pattern matched.

  2. holds the output field separator.

  3. identifies the current command line argument.

  4. none of the above is correct.


Correct Option: C

What is the value of $match? my $txt = 'I am learning Perl'; my ($match) = $txt =~ /\s(.*)\s/;

  1. am learning

  2. I am learning Perl

  3. learning

  4. am

  5. none


Correct Option: A

my $val = 'x'; print ref($val); What is the output?

  1. SCALAR

  2. empty value

  3. STRING

  4. not a reference


Correct Option: B

What will be the value of $str after execution of the following code? my $str = '112133'; $str =~ s/(.)\1/$1/g;

  1. 112133

  2. 1233

  3. 1213

  4. 12133


Correct Option: C

What will be printed? use strict; my @a = (1, 2, 3); my %b = (2 => undef); for my $val (@a) { last if $b{$val}; } print $val;

  1. undef

  2. 0

  3. 1

  4. 2

  5. the code is ill-formed


Correct Option: E

Data asthma; input city Asthma count; datalines; 1 1 35 1 0 65 2 1 40 2 0 60 3 1 25 3 0 75 ; run; proc format; value asth 0= 'No Asthma' 1= 'Asthma' ; run; Which of the following code produce the output : Asthma Frequency Percent ---------------------------------- Asthma 100 33.33 No Asthma 200 66.67

  1. proc freq data=asthma ; weight count; tables asthma / nocum; format asthma asth.; run;

  2. proc freq data=asthma order = formatted ; weight count; tables asthma / nocum; format asthma asth.; run;

  3. proc freq data=asthma order = formatted ; weight count; tables asthma ; format asthma asth.; run;

  4. proc freq data=asthma order = formatted ; tables asthma / nocum; format asthma asth.; run;


Correct Option: B

By default, PROC FREQ creates a table of frequencies and percentages for which data set variables?

  1. Character variables

  2. Numeric Variables

  3. Both Numeric & Character Variables.

  4. None : Variable names must be specified.


Correct Option: C

When processing a FREQ procedure it is possible to run out of memory due to the fact that this procedure stores all of the value combinations in memory during processing. In order to prevent this error, try using Proc SORT to sort the data by as many variables as you can and also include those sorted variables in a BY statement in your Proc FREQ procedure. True or False?

  1. True

  2. False


Correct Option: B

Several SAS procedures produce frequency counts; only PROC FREQ computes chi-square tests for one-way to n-way tables and measures of association and agreement for contingency tables

  1. True

  2. False


Correct Option: B

Frequency distributions work best with variables that contain

  1. Continuous values

  2. Numeric Values

  3. Categorical Values

  4. Unique Values


Correct Option: C

Which of the following is true about Proc Freq?

  1. For one-way frequency tables, PROC FREQ can compute statistics to test for equal proportions, specified proportions, or the binomial proportion

  2. PROC FREQ automatically displays the output in a report and can also save the output in a SAS data set.

  3. To estimate the strength of an association, PROC FREQ computes measures of association that tend to be close to zero when there is no association and close to the maximum (or minimum) value when there is perfect association.

  4. Statement 1 & 2

  5. Statement 2 & 3

  6. All of the above


Correct Option: F

Which program creates the output data set Work.Temp2? SAS Data Set Work.Temp Obs Month1 Month2 Month3 1 10 20 30 2 11 22 33 3 55 66 77 4 100 200 300 SAS Data Set Work.Temp2 Obs Month Quarter1 Quarter2 Quarter3 Quarter4 1 Month1 10 11 55 100 2 Month2 20 22 66 200 3 Month3 30 33 77 300

  1. proc transpose data=work.temp out=work.temp2 prefix=Quarter; run;

  2. proc transpose data=work.temp out=work.temp2 name=Month prefix=Quarter; run;

  3. proc transpose data=work.temp out=work.temp2 prefix=Month name=Quarter; run

  4. proc transpose data=work.temp out=work.temp2 prefix=Month index=Quarter; run;


Correct Option: B

What will be printed when you execute the following code? class X { Y b = new Y(); X() { System.out.print("X"); } } class Y { Y() { System.out.print("Y"); } } public class Z extends X { Y y = new Y(); Z() { System.out.print("Z"); } public static void main(String[] args) { new Z(); } }

  1. z

  2. yz

  3. xyz

  4. yxyz


Correct Option: C

What is the result when you compile and run the following code? public class Test { public void method() { for(int i = 0; i < 3; i++) { System.out.print(i); } System.out.print(i); } }

  1. 0122

  2. 0123

  3. Compilation error

  4. None of these


Correct Option: C

What is the result when you compile and run the following code? public class Test { public void method() { for(int i = 0; i < 3; i++) { System.out.print(i); } System.out.print(i); } }

  1. 0122

  2. 0123

  3. Compilation error

  4. None of these


Correct Option: C

What is the result when you compile and run the following code? public class ThrowsDemo { static void throwMethod() { System.out.println("Inside throwMethod."); throw new IllegalAccessException("demo"); } public static void main(String args[]) { try { throwMethod(); } catch (IllegalAccessException e) { System.out.println("Caught " + e); } } }

  1. Compile successfully, nothing is printed

  2. Runtime error

  3. Compilation error

  4. Inside throwMethod. followed by caught: java.lang.IllegalAccessExcption: demo


Correct Option: C

What results from the following code? 1. class MyClass 2. { 3. void myMethod(int i) {System.out.println("int version");} 4. void myMethod(String s) {System.out.println("String version");} 5. public static void main(String args[]) 6. { 7. MyClass obj = new MyClass(); 8. char ch = 'c'; 9. obj.myMethod(ch); 10. } 11. }

  1. The code compiles and produces output: int version.

  2. Line 9 will not compile as there is no version of myMethod which takes a char as argument.

  3. An exception at line 9.

  4. Line 4 will not compile as void methods can't be overridden.


Correct Option: A
+ View questions