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. tagname

  2. name

  3. tag

  4. prefix

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

To solve this question, the user needs to know about JSP and the syntax for defining custom tags in JSP using a tag library descriptor file. Specifically, the user should be familiar with the elements used in the tag library descriptor file.

In this case, the JSP file is using a custom tag defined in a tag library descriptor file. The myTag element in the JSP file should be defined in the tag library descriptor file using the "name" attribute in the "tag" element.

Now, let's go through each option and determine which one is correct:

A. tagname: This is not a valid option for defining a custom tag in a tag library descriptor file.

B. name: This is the correct answer. The "name" attribute in the "tag" element is used to define the name of the custom tag being defined in the tag library descriptor file.

C. tag: The "tag" element is used to define a custom tag in the tag library descriptor file, but it does not specify the name of the tag.

D. prefix: The "prefix" attribute in the "taglib" element is used to specify the prefix used for the custom tag library in the JSP file, but it does not define the custom tag itself.

Therefore, the correct answer is:

The Answer is: B. name

Multiple choice technology programming languages
  1. tlib-version

  2. short-name

  3. uri

  4. display-name

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

To solve this question, the user needs to know the structure of the taglib descriptor file (also known as the TLD file) used in JavaServer Pages (JSP) applications.

The taglib element is used to define a tag library and contains several optional and required sub-elements. The question asks which of these sub-elements are required.

Now, let's go through each option and explain why it is right or wrong:

A. tlib-version: This sub-element specifies the version of the tag library descriptor file. It is an optional sub-element, not required.

B. short-name: This sub-element specifies a short name for the tag library. It is a required sub-element.

C. uri: This sub-element specifies the URI of the tag library and is used to identify the tag library in JSP pages. It is a required sub-element.

D. display-name: This sub-element specifies a display name for the tag library. It is an optional sub-element, not required.

Therefore, the correct answers are:

  • B. short-name
  • C. uri

The Answer is: B and C

Multiple choice technology programming languages
  1. name

  2. description

  3. validator

  4. tag-class

  5. display-name

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

In a JSP taglib descriptor file, each tag must have at minimum the 'name' element (how the tag is referenced in JSP pages) and the 'tag-class' element (the fully-qualified class name implementing the tag's functionality). Description, validator, and display-name are optional elements.

Multiple choice technology programming languages
  1. class-name

  2. tag

  3. class

  4. tag-class

  5. tei-class

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

The 'tag-class' element within the tag element specifies the fully-qualified name of the Java class that implements the tag's functionality. This is the required element that connects the XML tag definition to the actual executable code. 'class-name', 'class', and 'tei-class' are not valid elements in the taglib descriptor.

Multiple choice technology operating systems
  1. A free implementation of PostScript

  2. A printing management tool

  3. A program for converting files to PostScript

  4. A free interpreter of PostScript

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

GhostScript is a free, open-source interpreter for PostScript and PDF. It can render, convert, and display PostScript/PDF documents. Option C describes a converter (too narrow), A says implementation (could mean compiler), and B describes a management tool - D is most accurate as 'interpreter'.

Multiple choice technology programming languages
  1. string strMessage = "Processing Successful"; string strScript = "<script language=javascript>alert('" + strMessage + "');</script>"; if(!ClientScript.IsClientScriptBlockRegistered("Startup")) {ClientScript.RegisterClientScriptBlock(Page.GetTy

  2. string strMessage = "Processing Successful"; string strScript = " alert('" + strMessage + "');"; if(!ClientScript.IsClientScriptBlockRegistered("Startup")) {ClientScript.RegisterClientScriptBlock(Page.GetType(), "startup", strScript);}

  3. string strMessage = "Processing Successful"; string strScript = "<script language=javascript>alert('" + strMessage + "');</script>"; ClientScript. RegisterStartupScript(Page.GetType(), "startup", strScript);

  4. string strMessage = "Processing Successful"; string strScript = " alert('" + strMessage + "');"; ClientScript. RegisterStartupScript(Page.GetType(), "startup", strScript);

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

RegisterClientScriptBlock registers script that executes during page load (before HTML renders), making it suitable for client-side alerts triggered by server-side processing. RegisterStartupScript would run after page load, which is less appropriate for immediate alerts.

Multiple choice technology programming languages
  1. Both cross browser and cross platform compatible

  2. XAML can be used for programming user interface

  3. Can be considered as replacement for Windows Presentation Foundation

  4. All of the above

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

Silverlight is not a replacement for Windows Presentation Foundation (WPF); rather, it is a lightweight, cross-platform browser plugin based on a subset of the WPF framework.

Multiple choice technology web technology
  1. <%@ page type="image/svg" %>

  2. <%@ page mimeType="image/svg" %>

  3. <%@ page language="image/svg" %>

  4. <%@ page contentType="image/svg" %>

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

The correct JSP directive to set HTTP response content type is '<%@ page contentType="image/svg" %>'. The contentType attribute specifies the MIME type. Options A (type), B (mimeType), and C (language) are not valid attributes for setting response content type.

Multiple choice technology programming languages
  1. (1) Dynamic entry point

  2. (2) Alternate entry point

  3. (3) Static entry point

  4. (4) Normarl enrty Point

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

To answer this question, the user needs to know about COBOL programs, entry points, and the use of the ENTRY label.

The ENTRY label in a COBOL program is used to specify another entry point at which a program will begin running. This allows the program to be executed from different starting points within the same program. The use of an alternate entry point enables a program to be divided into smaller, more manageable components.

Now, let's go through each option and explain why it is right or wrong:

A. (1) Dynamic entry point: This option is incorrect. Dynamic entry point refers to the ability of a program to call another program or subroutine at run time, rather than at compile time.

B. (2) Alternate entry point: This option is correct. The use of the ENTRY label in a COBOL program specifies an alternate entry point at which a program will begin running.

C. (3) Static entry point: This option is incorrect. A static entry point is a fixed starting point within a program that is determined at compile time.

D. (4) Normal entry point: This option is incorrect. There is no such term as a normal entry point in COBOL programming.

Therefore, the answer is: B. (2) Alternate entry point

Multiple choice technology programming languages
  1. (1) C/C++-to-COBOL programs calls

  2. (2) COBOL-to-C/C++ programs calls

  3. (3) COBOL-to-COBOL programs calls

  4. (4) C/C++-to-C/C++ programs calls

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

To answer this question, the user needs to know the difference between procedure pointers and function pointers and their respective use cases.

A function pointer is a pointer that points to a function. It can be used to call the function that it points to. A procedure pointer, on the other hand, is a pointer that points to a procedure. A procedure is similar to a function but does not return a value.

Now, let's go through each option and see which one is correct:

A. (1) C/C++-to-COBOL programs calls: This option is incorrect. Procedure pointers are not typically used in C/C++-to-COBOL programs calls. Instead, function pointers are used for this type of program.

B. (2) COBOL-to-C/C++ programs calls: This option is incorrect. Procedure pointers are not typically used in COBOL-to-C/C++ program calls. Instead, function pointers are used for this type of program.

C. (3) COBOL-to-COBOL programs calls: This option is correct. Procedure pointers are more efficient than function pointers for COBOL-to-COBOL program calls. This is because COBOL does not support function pointers, so procedure pointers must be used instead.

D. (4) C/C++-to-C/C++ programs calls: This option is incorrect. Function pointers are typically used for C/C++-to-C/C++ program calls, not procedure pointers.

Therefore, the correct answer is:

The Answer is: C. (3) COBOL-to-COBOL programs calls

Multiple choice technology programming languages
  1. (1) Compute the arithmetic operations

  2. (2) Control the maximum number of digits allowed for decimal numbers

  3. (3) Control the inappropriate datatype if it is used by mistake

  4. (4) Identify the sign of the variable being used in the program

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

The ARITH compiler option in IBM COBOL controls the maximum number of digits allowed for decimal numbers, determining whether the limit is 18 digits (COMPAT) or 31 digits (EXTEND).