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 mainframe
  1. Common Business Oriented Language

  2. Common Business Object Language

  3. Common Balls Of Light

  4. Common Object Business Oriented LAnguage

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

COBOL stands for Common Business Oriented Language, a high-level programming language designed for business applications. It was developed in 1959 and remains widely used in enterprise and government systems for transaction processing and administrative applications.

Multiple choice technology databases
  1. +

  2. *

  3. /

  4. _

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

In standard SQL operator precedence, multiplication (*) and division (/) have higher precedence than addition (+) and subtraction (-). When operators have equal precedence (like * and /), they are evaluated left-to-right. Among the options, * will be evaluated first assuming it appears before / in the expression.

Multiple choice technology web technology
  1. declarations

  2. scriptlets

  3. expressions

  4. All of the above

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

JSP scripting elements include declarations (for variable/method declarations), scriptlets (for Java code blocks), and expressions (for outputting values to the response). All three are fundamental JSP scripting constructs.

Multiple choice technology web technology
  1. <%– JSP Comment –%>

  2. <!– HTML Comment –>

  3. Both a and b

  4. None of the above

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

JSP supports both JSP-style comments &lt;%-- JSP Comment --%&gt; (which are stripped out before compilation) and standard HTML comments `` (which are sent to the client browser). Thus, both are valid types of comments in JSP development.

Multiple choice technology web technology
  1. Static Content

  2. Dynamic content

  3. Both a and b

  4. None of the above

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

JSP content consists of two types: static content (HTML, plain text that is sent to the browser as-is) and dynamic content (JSP elements, scriptlets, expressions that are executed on the server). Both types are used together in a JSP page.

Multiple choice technology programming languages
  1. <session-config> <session-timeout>10</session-timeout> </session-config>

  2. <session-config> <session-timeout>600</session-timeout> </session-config>

  3. <session-time-config> <session-timeout>600</session-timeout> </session-time-config>

  4. <session-config> <session-invalid-time>60</ session-invalid-time> </session-config>

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

Session timeout in web.xml is specified in MINUTES within the element, not seconds. The value 10 represents 10 minutes, whereas 600 would be 600 minutes (10 hours), which is incorrect for this requirement. The element is the correct parent for session timeout configuration.

Multiple choice technology web technology
  1. <% %>

  2. <%= %>

  3. <%! %>

  4. <!-- -->

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

JSP (JavaServer Pages) uses specific syntax for different types of code: <%= %> for expressions (evaluated and output), <% %> for scriptlets (Java code), and <%! %> for declarations. Expressions enclosed in <%= %> are evaluated at runtime and their result is sent to the output stream.

Multiple choice technology web technology
  1. page

  2. include

  3. taglib

  4. all the above

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

JSP provides three main types of directives: page directive (for page-specific settings like content type, session, imports), include directive (for including files at translation time), and taglib directive (for importing custom tag libraries). Each directive type serves a specific purpose in JSP page configuration and behavior control.

Multiple choice technology web technology
  1. extends

  2. session

  3. import

  4. language

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

The import directive is the only JSP page directive that can be declared multiple times in a single translation unit to import different packages. Other page directives, such as extends, session, or language, define unique page-level attributes and can only be specified once per JSP file.

Multiple choice technology testing
  1. True

  2. False

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

In a pest/defect tracking system (PEST likely refers to Project Error/Issue Tracking System), the testing type is a MANDATORY field. Every defect must be categorized by testing type (functional, performance, security, etc.) for proper triage, assignment, and metric analysis. This metadata is essential for defect lifecycle management.

Multiple choice technology web technology
  1. mysql_selectDB_server($server,$user,$password)
  2. mysql_connection($server,$user,$password)
  3. mysql_connect($server,$user,$password)
  4. database_connect($mysql,$server,$user,$password,$database)
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

mysql_connect() was the standard function in PHP's mysql extension (now deprecated) to establish a connection to a MySQL database server using the server address, username, and password parameters. Note that this extension is deprecated in favor of mysqli or PDO.

Multiple choice technology web technology
  1. $object.method()
  2. $object->$method()
  3. $object:$method()
  4. $object->method()
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In PHP, object methods are called using the arrow operator (->), which is the standard syntax for accessing properties and methods of an object. This is distinct from languages like JavaScript or Java that use dot notation.

Multiple choice technology web technology
  1. Object attributes are not of any specific data type

  2. The constructor of the class is not correctly defined

  3. You cannot put an equal when recieving a parameter in the constructor

  4. The word function is missing before the class constructor

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

In PHP 5, class constructors must be declared with the 'function' keyword before __construct() or the class-name method. The constructor is a special method that's automatically called when an object is instantiated, but it still requires standard function declaration syntax.