SAS and C Programming Fundamentals
Quiz covering basic SAS programming concepts (string functions, syntax, merge operations) and C programming fundamentals (pointers, structs, control flow)
Questions
void main() { ; }
- Compilation Error - Undeclared Identifier
- Compilation Error - Syntax
- I dont know
- Will Compile but no Output
void main() { struct { int EmpNo; } var; var.EmpNo=193149; printf("EmpNo: %d",var.EmpNo); }
- Compilation Error - Struct cannot be defined without a name
- 193149
- Compilation Error - Struct cannot be defined inside a Function
- Some Random Number
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; } }
- HelloA
- HelloB
- HelloABCD
- HelloD
- HelloC
- Compilation Error
void main() { int Add() { return 50; } printf("%d",Add()); }
- Compilation Error - Cannot define Function inside Function
- 50
- Cant say
- Some Random Number
void main() { printf("Hello"); return 5; printf(" World"); }
- I have started hating C now!!
- Hello
- Compilation Error - Cannot return when return type is Void
- Hello World
- Segmentation fault
void main() { int *ptr; int item=5; int arr[]={10,20,30,40,50}; ptr = &item; for(;item>=0;item--) { printf("%d ",*ptr); ptr--; } }
- 5 50 40 30 20 10
- 5 Followed by Random Numbers
- 5 4 3 2 1
- Segmentation Fault
Using Proc SQL, we can create a macro variable.
- True
- False
void main() { int i=5; i+=i*=i-=i/i; printf("%d",i); }
- 5
- 25
- 20
- 32
How many types of Merge are there.
- 1
- 2
- 3
- 4
Todays() returns__________?
- January 1, 1960
- today’s date(number of days since January 1, 1960).
- 1960
- January 1960
Each statement in SAS should end with semicolon (;)
- True
- False
Lines beginning with an asterisk (*) are not treated as comments.
- True
- False
Interpret the meaning of the code %include "readit.sas";
- It will run the readit.sas file
- It will have the reference of the readit.sas file
- It neither have the reference nor run the readit.sas file
- None of the above
By using __________, we can suppress the page number in the output
- nopagenumber
- npagenumber
- nonumber
- no pagenumber
length(string) - returns number of characters in a string
- True
- False
scan(string,n,) - returns the nth “word” in string
- True
- False
substr(string,position,) - returns pieces of a variable
- True
- False
translate(string,to,from) - changes from chars to to chars
- True
- False