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
D
Correct answer
Explanation
When assigning an array to a list of scalars, array elements are assigned left-to-right. $scalar1 gets the first element (1), but there are more scalars than elements, so remaining scalars get undef. The print shows 'Null value' (undef rendered as empty) and '5' ($scalar2 never got assigned, defaulting to undef/empty).
-
Compiled Language
-
Interpretive Language
-
Machine Language
-
All the above
B
Correct answer
Explanation
Perl is historically and primarily classified as an interpretive (interpreted) language, where scripts are compiled into an internal representation and executed by the Perl interpreter, rather than compiled directly to native machine code beforehand.
-
1 2 Null value
-
1 2 0
-
1 2 3
-
Error:Array out of bound
A
Correct answer
Explanation
In Perl, when a 2-element array is assigned to 3 scalars, the third scalar receives undef (undefined). When printed, undef produces an empty string or an uninitialized value warning. 'Null value' is non-standard Perl terminology but refers to undef.
-
50
-
NULL
-
5
-
None of the above
C
Correct answer
Explanation
The key concept here is how NULL behaves in PL/SQL comparisons. Any comparison with NULL returns NULL (unknown), not true or false. Since variable b is NULL, the expression 'a > b' evaluates to NULL, making the entire AND condition NULL. Because the condition is not true, the IF block doesn't execute, and 'a' remains unchanged at its initial value of 5. Therefore option C (5) is correct.
-
50
-
NULL
-
5
-
None of the above
C
Correct answer
Explanation
The condition a > b (5 > NULL) evaluates to NULL/UNKNOWN because any comparison with NULL returns NULL. In SQL/PLSQL, NULL AND FALSE/TRUE = NULL (falsy). Since the AND condition short-circuits on the NULL result from a > b, the entire condition is false, the IF block doesn't execute, and 'a' remains unchanged at 5.
-
Java based
-
C++ based
-
Event based
-
C# based
C
Correct answer
Explanation
Flash (ActionScript) programming is fundamentally event-based, responding to user actions like clicks, key presses, and timeline events. While ActionScript has ECMAScript roots (like JavaScript), it is not based on Java, C++, or C#. The event-driven architecture is central to Flash interactive applications.
-
Swf will run perfectly
-
Swf will not run
-
Swf will run but with an error
-
Flash will generate a new .as file
A
Correct answer
Explanation
When you publish a Flash movie, the ActionScript code (.as files) is compiled into the SWF file. The SWF is a standalone file that contains all necessary bytecode and assets, so it runs perfectly without the original .as files. The source files are only needed during development and for recompilation if you want to make changes.
-
_level0 will be same for both
-
_root will be same for both
-
_level0 will be different for both
-
None of them
A
Correct answer
Explanation
In Flash ActionScript, _level0 always refers to the main movie timeline at level 0 of the Flash Player, regardless of which SWF you're in. The _root property, however, is relative to each SWF's own main timeline. When 1.swf is loaded into 2.swf, _root in 1.swf refers to 1.swf's timeline, while _level0 remains the same global reference for both.
-
Movie Clip is dynamically attached
-
Movie Clip is physically laying on the root
-
Movie Clip is on _level0 only
-
Movie Clip is empty
A
Correct answer
Explanation
In ActionScript, the removeMovieClip() function only works on movie clip instances that were created dynamically at runtime (e.g., using attachMovie or duplicateMovieClip). Author-time timeline instances cannot be directly removed this way.
-
ActiveRecord
-
ApplicationRecord
-
ActiveSummary
-
ActiveModel
A
Correct answer
Explanation
In Rails, every model class inherits from ActiveRecord::Base (or ApplicationRecord in Rails 5+, which itself inherits from ActiveRecord::Base). This provides ORM functionality, database interaction, validations, and associations. ActiveRecord is the core Rails component that connects models to database tables. ActiveModel is for non-database models, and the other options don't exist.
-
Compiled and Procedural Programming Language
-
Interpreted and Object Oriented Programming Language
-
Interpreted and Procedural Programming language
-
Compiled and Object Oriented Programming Language
B
Correct answer
Explanation
Ruby is an interpreted language, meaning code is executed directly without prior compilation, and it's purely object-oriented where everything (including numbers and booleans) is an object. This combination allows for dynamic typing and flexible programming styles.
-
Ounce
-
WebGoat
-
FxCop
-
Visual Studio
C
Correct answer
Explanation
FxCop (FxCop.exe) is Microsoft's free static code analysis tool that analyzes .NET assemblies against Microsoft's .NET Framework Design Guidelines. It checks for naming conventions, library design, security, and performance best practices. Visual Studio is an IDE, not a static analysis tool, while Ounce and WebGoat are unrelated to Microsoft's design guidelines.
-
Java sand box environment provides protection against decompilation
-
Java is compiled into ELF binaries and cannot be decompiled
-
Java byte code can always be decompiled, code obfuscators can make the reverse engineering process more time confusing but cannot prevent it
-
Java is difficult to decompile because the Just-In-Time compiler automatically perform string encryption by default
C
Correct answer
Explanation
Java bytecode can always be decompiled because it contains enough metadata to reconstruct readable source code. Code obfuscators make decompilation harder by renaming variables and obscuring control flow, but cannot prevent it. The Java sandbox (A) is about runtime security, not decompilation prevention. Java is not compiled to ELF binaries (B). JIT compilers don't perform string encryption by default (D).
-
overload method
-
override method
-
ploymorphism
-
none
D
Correct answer
Explanation
In most programming languages like Java, methods with the same name and same argument list must have the same return type. Different return types alone do not constitute valid overloading or overriding - this creates ambiguity and is not allowed.
B
Correct answer
Explanation
The PERFORM VARYING loop executes with C starting at 1 and incrementing by 1 until C reaches 6. This means the loop runs when C = 1, 2, 3, 4, 5 (5 iterations total). Each iteration increments RESULT by 1, starting from 0, so the final value is 5. The loop stops before executing when C = 6.