0

programming languages Online Quiz - 256

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

You have to sort the dataset Temp by the values of salary in descending order. SORT procedure is given below. Find out the missing statement? Data temp; Infile datalines; Input empname $ salary; Datalines; AAA 25000 BBB 45000 CCC 36000 DDD 47000 ; Proc sort data=temp; <<<<<<>>>>>>>>>; Run;

  1. by descending salary

  2. by salary descending

  3. by salary ascending

  4. by salary


Correct Option: A

How can you assign a value from a datastep to a macro variable?

  1. Using Symget function

  2. Using Symput function

  3. Using Assign function

  4. Using Sysfunc function


Correct Option: B

Can we use title statement inside Proc SQL?

  1. True

  2. False


Correct Option: B

What is the value of z? z=weekday(today()); Today being Wednesday, 30 September 2009

  1. 2

  2. 3

  3. 5

  4. 4


Correct Option: D

What are the different classes of tokens available in SAS?

  1. Literals, Numbers, Strings and Symbols

  2. Literals, Numbers, Names and Special Characters

  3. Literals, Characters, Special Characters and Symbols

  4. Characters and Numbers only


Correct Option: B

What is the use of macro function %SYSFUNC?

  1. Used to execute SAS Functions

  2. Used to execute SAS Statements

  3. Used to pass parameters to a macro function

  4. All of the above


Correct Option: A

In Proc SQL, Index can be created on tables and views. State whether the statement is true or false. Also classify the index types in Proc SQL?

  1. True, Simple and Complex

  2. False, Simple and Composite

  3. True, Simple and Composite

  4. False, Simple and Complex


Correct Option: B

What is the value stored in the variable x? Data test; name = ’TATA CONSULTANCY SERVICES’; b = ’C’; x = INDEX (name, b); Run;

  1. 2

  2. 23

  3. 6

  4. 5


Correct Option: C

What is the use of %INCLUDE statement in a program?

  1. Includes external files

  2. Includes SAS datasets

  3. Includes variables from other datasets

  4. All of the above


Correct Option: A

What is the SAS data value of 01-Jan-1960?

  1. 21916

  2. 1

  3. 0

  4. None of the above


Correct Option: C

How many variables will be there in the output dataset totmark? Data totmark; Set scores (keep=name mark1 mark2 ); Total = mark1 + mark2; Drop mark1 mark2; Run;

  1. 2

  2. 4

  3. 5

  4. 1


Correct Option: A

State which of the following statement(s) are correct regarding Proc SQL?

  1. In simple index, the index name must be same as the column name.

  2. The values must be in sorted form

  3. Indexing helps to retrieve the data faster

  4. All of the above


Correct Option: A,C

char* riteshFunc (char *ptr) { ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = riteshFunc(x); printf ("y = %s \n", y); return 0; } What will print when the sample code above is executed?

  1. HELLO

  2. ELLO

  3. LLO

  4. LO


Correct Option: D

What will be the result of compiling and running the following code? (Assume that assertions are enabled at compile time as well as at runtime.) class Test { String f(int i) { switch (i) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: assert false; } } public static void main(String[] args) { Test t = new Test(); for (int i = 0; i < 4; i++) { System.out.print(t.f(i)); } } }

  1. Prints "ABC" and throws AssertionError

  2. Prints "ABC" and throws AssertionException

  3. Prints "ABC" and exits without any error

  4. Compilation error

  5. Run time exception

  6. None of the above


Correct Option: D

Given the code below, which access modifiers (public, protected, or private) can legally be placed before the myMethod() method on line 3, if no other changes are made to the code? If line 3 is left as it is, which keywords can legally be placed before the myMethod method on line 8? 1. class HumptyDumpty 2. { 3. void myMethod() {} 4. } 5. 6. class HankyPanky extends HumptyDumpty 7. { 8. void myMethod() {} 9. }

  1. . private or nothing (default) on line 3. Nothing (default) or protected or public on line 8.

  2. public or protected on line 3. private or nothing (default) on line 8.

  3. Nothing (default) or protected or public on line 3. private or nothing (default) on line 8.

  4. public on line 3 and private on line8.


Correct Option: A

Which is the most appropriate way to handle invalid method arguments passed to a public method?

  1. Throw AssertionError

  2. Throw IllegalStateException

  3. Throw IllegalArgumentException

  4. Throw InvalidArgumentException


Correct Option: C

What will be printed on standard output if the following class is executed using the command "java Test 1 two 3" ? public class Test { static public void main(String[] args) { try { int k = Integer.parseInt(args[1]); System.out.println(args[k]); } catch (Exception e) { System.out.println(e); } } }

  1. 1

  2. two

  3. NumberFormatException

  4. ArrayIndexOutOfBoundsException

  5. Code does not compile


Correct Option: C

What will be the result of compiling and running the following code? public class MyThread extends Thread { public static void main(String[] args) { new MyThread().start(); } }

  1. Compile-time error

  2. Runtime error

  3. No output

  4. None of these


Correct Option: C

Given the following two classes, which statement is true? ---------- class-1 ---------- package pack; public class Parent { protected void test() { System.out.println("Test"); } } ---------- class-2 ---------- 1. package mypack; 2. import pack.*; 3. class ParentTest extends Parent{ 4. public static void main(String[] args){ 5. new ParentTest().test(); 6. new Parent().test(); 7. } 8. }

  1. The code will compile and run only if line 5 is removed.

  2. The code will compile and run only if line 6 is removed

  3. The code compiles and runs, printing "Test" twice

  4. The code compiles but throws an exception at runtime


Correct Option: B
- Hide questions