SAS and C Programming Fundamentals

Quiz covering basic SAS programming concepts (string functions, syntax, merge operations) and C programming fundamentals (pointers, structs, control flow)

18 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

void main() { ; }

  1. Compilation Error - Undeclared Identifier
  2. Compilation Error - Syntax
  3. I dont know
  4. Will Compile but no Output
Question 2 Multiple Choice (Single Answer)

void main() { struct { int EmpNo; } var; var.EmpNo=193149; printf("EmpNo: %d",var.EmpNo); }

  1. Compilation Error - Struct cannot be defined without a name
  2. 193149
  3. Compilation Error - Struct cannot be defined inside a Function
  4. Some Random Number
Question 3 Multiple Choice (Single Answer)

void main() { char ch='ABCD'; switch(ch) { case 'ABCD': printf("HelloABCD"); break; case 'A': printf("HelloA"); break; case 'B': printf("HelloB"); break; case 'C': printf("HelloC"); break; case 'D': printf("HelloD"); break; } }

  1. HelloA
  2. HelloB
  3. HelloABCD
  4. HelloD
  5. HelloC
  6. Compilation Error
Question 4 Multiple Choice (Single Answer)

void main() { int Add() { return 50; } printf("%d",Add()); }

  1. Compilation Error - Cannot define Function inside Function
  2. 50
  3. Cant say
  4. Some Random Number
Question 5 Multiple Choice (Single Answer)

void main() { printf("Hello"); return 5; printf(" World"); }

  1. I have started hating C now!!
  2. Hello
  3. Compilation Error - Cannot return when return type is Void
  4. Hello World
  5. Segmentation fault
Question 6 Multiple Choice (Single Answer)

void main() { int *ptr; int item=5; int arr[]={10,20,30,40,50}; ptr = &item; for(;item>=0;item--) { printf("%d ",*ptr); ptr--; } }

  1. 5 50 40 30 20 10
  2. 5 Followed by Random Numbers
  3. 5 4 3 2 1
  4. Segmentation Fault
Question 7 True/False

Using Proc SQL, we can create a macro variable.

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

void main() { int i=5; i+=i*=i-=i/i; printf("%d",i); }

  1. 5
  2. 25
  3. 20
  4. 32
Question 9 Multiple Choice (Single Answer)

How many types of Merge are there.

  1. 1
  2. 2
  3. 3
  4. 4
Question 10 Multiple Choice (Single Answer)

Todays() returns__________?

  1. January 1, 1960
  2. today’s date(number of days since January 1, 1960).
  3. 1960
  4. January 1960
Question 11 True/False

Each statement in SAS should end with semicolon (;)

  1. True
  2. False
Question 12 True/False

Lines beginning with an asterisk (*) are not treated as comments.

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

Interpret the meaning of the code %include "readit.sas";

  1. It will run the readit.sas file
  2. It will have the reference of the readit.sas file
  3. It neither have the reference nor run the readit.sas file
  4. None of the above
Question 14 Multiple Choice (Single Answer)

By using __________, we can suppress the page number in the output

  1. nopagenumber
  2. npagenumber
  3. nonumber
  4. no pagenumber
Question 15 True/False

length(string) - returns number of characters in a string

  1. True
  2. False
Question 16 True/False

scan(string,n,) - returns the nth “word” in string

  1. True
  2. False
Question 17 True/False

substr(string,position,) - returns pieces of a variable

  1. True
  2. False
Question 18 True/False

translate(string,to,from) - changes from chars to to chars

  1. True
  2. False