Computer Knowledge
Programming Languages and Compilers
2,284 Questions
Programming languages and compilers involve the rules, syntax, and semantics used to write and execute software programs. Key areas include scripting languages, object oriented concepts, and parsing algorithms like top down parsers. Practice these computer science questions to build proficiency for technical and computer knowledge exams.
Object oriented languagesScripting languagesCompilers and parsersProgramming syntax
Programming Languages and Compilers Questions
-
conio.h
-
stdio.h
-
ctype.h
-
stdlib.h
C
Correct answer
Explanation
isalpha() is a character classification function that checks whether a character is alphabetic. It's declared in ctype.h, which contains all character type testing functions.
-
stdlib.h
-
conio.h
-
dos.h
-
ctype.h
A
Correct answer
Explanation
exit() is declared in stdlib.h (cstdlib in C++). This function terminates the program normally and performs cleanup operations.
-
SEQUENCE
-
BRANCH
-
LOOP
-
REPEAT
B
Correct answer
Explanation
The BRANCH construct allows conditional execution of steps based on runtime variable values. SEQUENCE executes steps linearly, LOOP and REPEAT are for iteration, while BRANCH provides decision-making capability at runtime.
C
Correct answer
Explanation
Setting the count parameter to -1 in a REPEAT operation creates an infinite loop that continues as long as the repeat condition remains true. A count of 0 would prevent any execution, while 1 would execute once regardless of condition.
D
Correct answer
Explanation
WML (Wireless Markup Language) is used to create applications and content for WAP-enabled devices. It's similar to HTML but designed for low-bandwidth wireless devices with small displays.
-
Web Services Developing Language
-
Web Services Definition Language
-
Web Servers Definition Language
-
None of these
B
Correct answer
Explanation
WSDL stands for Web Services Definition Language. It is an XML-based language used to describe web services, their format, and how to access them. The key distractor A incorrectly says 'Developing' instead of 'Definition'.
B
Correct answer
Explanation
SSIS variables can be defined at multiple scopes: package level, container level, task level, or event handler level. They are not restricted to only the entire package scope.
-
A type of coffee
-
An object-oriented programming language
-
An interactive website
-
None of the above
B
Correct answer
Explanation
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. It was developed by Sun Microsystems (now Oracle) and is widely used for enterprise applications, Android development, and web backends. Coffee was the original inspiration for the name, but Java itself is code.
-
CHAR
-
ORD
-
REM
-
REVERSE
-
ANNUITY
-
None
F
Correct answer
Explanation
All listed functions are valid COBOL intrinsic functions: CHAR converts numeric to character, ORD returns ASCII ordinal value, REM calculates remainder of division, REVERSE reverses character strings, and ANNUITY calculates financial annuity values. Therefore 'None' correctly indicates that none of these is NOT an intrinsic function.
-
Compilation Error
-
Executes successfully
-
Run time Error
-
Logical Error
B
Correct answer
Explanation
When you redefine a field with a larger picture clause, you're creating an alternate view of storage. Most systems allow this and the code executes, though there may be overlapping memory concerns. Option A (Compilation Error) would occur for syntax violations, and Option C (Run time Error) typically happens during execution for invalid operations.
B
Correct answer
Explanation
Pega's declarative rules are specifically designed for property calculations and validations because they execute automatically when dependencies change, improve performance, and reduce manual coding. The statement incorrectly advises against using them.
-
%macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex;
-
%macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start %to &stop %by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex;
-
%macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; run; %mend hex;
-
%macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadeciaml form of &i is " value hex6.; %end run; %mend hex;
B
Correct answer
Explanation
In SAS macro loops, the iteration syntax requires percent signs before TO and BY: %DO variable=start %TO stop %BY increment. Options A, C, and D use the incorrect DATA step syntax (to, by without %). Option B correctly uses %TO and %BY, and properly structures the macro with %LOCAL for the loop variable and matching %END. The other options either use wrong syntax or have structural errors (missing %END, misspelling, wrong placement of RUN).
-
A %MACRO statement must always be paired with a %MEND statement.
-
A macro definition can include macro variable references, but it cannot include SAS language statements.
-
Only macro language statements are checked for syntax errors when the macro is compiled.
-
Compiled macros are stored in a temporary SAS catalog by default.
B
Correct answer
Explanation
A %MACRO must always be terminated by %MEND, so that statement is true. Macro definitions can contain SAS language statements, making the claim that they cannot include such statements false. The other statements about syntax checking and temporary catalog storage are true, so the false option is the one marked correct.
-
you must place %DO and %END statements around code that describes the conditional action, if that code contains multiple statements.
-
the %ELSE statement is optional.
-
you cannot refer to DATA step variables in the logical expression of the %IF statement.
-
all of the above.
D
Correct answer
Explanation
In SAS macro programming, multiple statements in a conditional block require %DO and %END. The %ELSE clause is optional, and DATA step variables cannot be directly referenced in macro %IF conditions because macros execute before the DATA step compiler runs. Thus, all statements are correct.
-
. Line 1 will not compile
-
. Line 2 will not compile
-
. Line 3 will not compile
-
. Line 4 will not compile
A,D
Correct answer
Explanation
Line 1 fails because # is not a valid character to start an identifier in Java - identifiers must begin with a letter, underscore _, or dollar sign $. Line 4 fails because ~ is never valid in an identifier. Lines 2 and 3 compile: \$age (dollar is valid) and _height (underscore is valid) are legal identifiers. The key distinction is the allowed starting characters for Java identifiers.