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

Multiple choice technology programming languages
  1. 1 2

  2. 4 5

  3. 5 5

  4. Null value 5

Reveal answer Fill a bubble to check yourself
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).

Multiple choice technology programming languages
  1. Compiled Language

  2. Interpretive Language

  3. Machine Language

  4. All the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. 1 2 Null value

  2. 1 2 0

  3. 1 2 3

  4. Error:Array out of bound

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. 50

  2. NULL

  3. 5

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. 50

  2. NULL

  3. 5

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Java based

  2. C++ based

  3. Event based

  4. C# based

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Swf will run perfectly

  2. Swf will not run

  3. Swf will run but with an error

  4. Flash will generate a new .as file

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. _level0 will be same for both

  2. _root will be same for both

  3. _level0 will be different for both

  4. None of them

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Movie Clip is dynamically attached

  2. Movie Clip is physically laying on the root

  3. Movie Clip is on _level0 only

  4. Movie Clip is empty

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. ActiveRecord

  2. ApplicationRecord

  3. ActiveSummary

  4. ActiveModel

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Compiled and Procedural Programming Language

  2. Interpreted and Object Oriented Programming Language

  3. Interpreted and Procedural Programming language

  4. Compiled and Object Oriented Programming Language

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. Ounce

  2. WebGoat

  3. FxCop

  4. Visual Studio

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. Java sand box environment provides protection against decompilation

  2. Java is compiled into ELF binaries and cannot be decompiled

  3. Java byte code can always be decompiled, code obfuscators can make the reverse engineering process more time confusing but cannot prevent it

  4. Java is difficult to decompile because the Just-In-Time compiler automatically perform string encryption by default

Reveal answer Fill a bubble to check yourself
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).

Multiple choice technology programming languages
  1. overload method

  2. override method

  3. ploymorphism

  4. none

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. 4

  2. 5

  3. 6

  4. 7

Reveal answer Fill a bubble to check yourself
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.