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 javascript
  1. Check for the presence of certain characters

  2. Check the position of substrings

  3. Test the length of data

  4. Check the variable type of the strings

  5. Either ABC

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Form validation using string methods typically involves checking character presence (indexOf/includes), substring positions (indexOf/search), and testing data length (length property). All three techniques are commonly used together for robust validation.

Multiple choice javascript
  1. Events

  2. Classes

  3. Objects

  4. DLL

  5. Components

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

JavaScript programs are event-driven, meaning they respond to user actions like clicks, keystrokes, and page loads. The core execution model is based on event handlers and callbacks rather than classes, DLLs, or traditional component architectures.

Multiple choice javascript
  1. It is based on object creation

  2. It focuses on component building

  3. It focuses on logic flow

  4. It emphasis on SCRIPTING

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

JavaScript is primarily a client-side scripting language designed for web browsers, hence its emphasis on SCRIPTING. Unlike compiled languages focused on object creation or component building, JavaScript's main purpose is adding interactivity to web pages through scripts.

Multiple choice perl
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

CGI (Common Gateway Interface) is NOT a programming language - it's a protocol or standard for web servers to execute external programs and generate dynamic web content. CGI programs can be written in Perl, Python, C, or any other language that the server supports. The interface itself is language-agnostic.

Multiple choice php
  1. normal

  2. aborted

  3. timeout

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

PHP connection states track the status of a client connection to the server. Normal means the connection is active, aborted means the client disconnected, and timeout means the connection exceeded the time limit. All three states are valid connection states in PHP, making option D correct.

Multiple choice php
  1. <?php>...</?>

  2. <?php…?>

  3. <script>...</script>

  4. <&>...</&>

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PHP code is embedded in HTML using opening delimiters. This tells the server to parse everything between these tags as PHP code. The correct syntax is without any angle brackets on the closing tag. Option B shows the correct delimiter syntax.

Multiple choice php
  1. "Hello World";

  2. echo "Hello World";

  3. Document.Write("Hello World");

  4. response.write("Hello World")

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The echo statement is the most common way to output text to the browser in PHP. Option 4371 is just a string literal without an output command. 4373 is JavaScript syntax, and 4374 is ASP syntax. PHP requires an explicit command like echo or print to generate output.

Multiple choice php
  1. mysql_open("localhost");

  2. connect_mysql("localhost");

  3. dbopen("localhost");

  4. mysql_connect("localhost");

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

mysql_connect() was the standard function to connect to MySQL databases in PHP 4 and early PHP 5 (before PDO or mysqli were introduced). Options A, B, and C use non-existent function names. Note that mysql_* functions are deprecated in PHP 5.5+ and removed in PHP 7.0.

Multiple choice php
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In PHP 5, MySQL support was NOT enabled by default. It had to be explicitly enabled in php.ini by uncommenting or adding extension=php_mysql.so (Unix) or extension=php_mysql.dll (Windows). This was a common source of confusion for beginners.

Multiple choice php
  1. It requires short tags and this is not compatible with XML

  2. There is no problem

  3. This syntax doesn't even exist It requires a special PHP library that may not always be available

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The short echo syntax =$expression ?> requires short_open_tag to be enabled in php.ini. This conflicts with XML declarations which also start with . Since PHP 5.4, short echo tags are always available regardless of short_open_tag setting, but full short tags ?> still conflict with XML and are discouraged for portable code.