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. Adding technical settings to the table

  2. Checking the table syntax

  3. Saving the table

  4. Activating the table

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

To create a transparent table in the ABAP Dictionary, the user must perform several steps. However, only one of these steps automatically creates the table in the underlying database.

The user needs to know that transparent tables are used to store data in the database and can be accessed using SQL commands.

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

A. Adding technical settings to the table: This step is necessary in order to define the structure of the table, such as the fields and their data types, keys, and other technical settings. However, it does not automatically create the table in the database.

B. Checking the table syntax: This step checks the syntax of the table definition and ensures that it is valid. It does not create the table in the database.

C. Saving the table: This step saves the table definition in the ABAP Dictionary, but it does not create the table in the database.

D. Activating the table: This step automatically creates the table in the underlying database. When the user activates the table, the system generates the SQL code to create the table and execute it in the database.

Therefore, the correct answer is:

The Answer is: D

Multiple choice technology programming languages
  1. SAS ignores the RUN statement, executes the statements as usual.

  2. Stop running due to error.

  3. Executes the code with a warning note

  4. Unexpected Result.

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

PROC SQL executes statement by statement. Because of this interactive execution, SAS ignores any RUN statement encountered during the PROC SQL block and continues normal execution.

Multiple choice technology programming languages
  1. Profit=price-cost

  2. price-cost as Profit

  3. profit=price-cost

  4. Profit as price-cost

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

In SQL (including PROC SQL), the correct syntax for creating a calculated column with an alias is to place the expression first, followed by the AS keyword and the column name. The syntax 'price-cost as Profit' calculates the difference and names it Profit. Other options either use incorrect operator placement or improper alias syntax.

Multiple choice technology programming languages
  1. proc sql nodup; select membertype from sasuser.frequentflyers;

  2. proc sql; select distinct(membertype) as MemberType from sasuser.frequentflyers;

  3. proc sql; select unique membertype from sasuser.frequentflyers group by membertype;

  4. proc sql; select distinct membertype from sasuser.frequentflyers;

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

The standard SQL syntax to filter out duplicate records from a query's output is SELECT DISTINCT column_name. Other options use incorrect keywords or syntax for duplicate removal.

Multiple choice technology programming languages
  1. The step does not execute.

  2. The first numeric column is summed by default.

  3. The GROUP BY clause is changed to an ORDER BY clause.

  4. The step executes but does not group or sort data.

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

When GROUP BY is used without an aggregate function in PROC SQL, SAS automatically converts it to an ORDER BY clause. This is a SAS-specific behavior that prevents errors. The query executes and sorts the data rather than producing grouped summaries.

Multiple choice technology programming languages
  1. SELECT

  2. FROM

  3. WHERE

  4. GROUP BY

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

The FROM clause is incorrect because it attempts to reference two tables (company.employees and company.health) without proper join syntax. PROC SQL requires explicit JOIN syntax or comma-separated tables with appropriate join conditions in the WHERE clause. The correct FROM clause should specify the join relationship between these tables.

Multiple choice technology programming languages
  1. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where balance <= 0

  2. proc sql; select name, spent, 120-spent as Balance from Company.Absences where calculated balance <= 0;

  3. proc sql; select name, spent, 120-spent as Balance from Company.Absences where balance <= 0;

  4. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where calculated balance <= 0;

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

When referring to a calculated column in the WHERE clause, you must use the CALCULATED keyword to inform PROC SQL that the column is created in the SELECT clause. Option B correctly defines the Balance column and references it with 'calculated balance' in the WHERE clause. Options A and C fail without CALCULATED, while D redundantly uses it in the SELECT clause.

Multiple choice technology programming languages
  1. Restricts the number of rows (observations) that PROC SQL retrieves from any single source.

  2. Restricts the number of rows (observations) that PROC SQL can print.

  3. Directs the system to start reading the source from 10th observation.

  4. None of the above.

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

The INOBS= option in PROC SQL restricts the number of rows retrieved from any source table to the specified value. This is useful for testing queries on large datasets by limiting input rows. It does not affect output display or starting position - those functions belong to OUTOBS= and FIRSTOBS= respectively.

Multiple choice technology programming languages
  1. Error: as mathematical computation is not allowed while using proc sql.

  2. ERROR: The following columns were not found in the contributing tables: total.

  3. Warning : the type of the variable total is not declared(character or numeric).But due to automatic conversion, some unexpected value is being populated in variable total.

  4. Error: variable total nor recognized(because there are two spelling - Total and total)

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

SAS PROC SQL evaluates the WHERE clause before the SELECT clause. Therefore, referencing a column alias like total in the WHERE clause without the CALCULATED keyword fails with a column-not-found error.

Multiple choice technology programming languages
  1. proc sql; select membertype sum(milestraveled) as TotalMiles from frequentflyers group by membertype;

  2. proc sql; select membertype sum(milestraveled) as TotalMiles from frequentflyers order by membertype;

  3. proc sql; select membertype milestraveled sum(milestraveled) as TotalMiles from sasuser.frequentflyers group by membertype;

  4. proc sql; select membertype sum(milestraveled) from frequentflyers group by membertype;

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

To get total miles by membership type, use SUM(milestraveled) as the aggregate function with GROUP BY membertype. Option A correctly uses both SUM() and GROUP BY to calculate totals for each category. Option B uses ORDER BY instead of GROUP BY, which sorts but doesn't aggregate. Option C includes an unaggregated column, and Option D omits the alias for the calculated column.

Multiple choice technology programming languages
  1. This restricts the number of rows (observations) in the output to 10.

  2. Tells the system to process first 10 observation from a SAS dataset

  3. Restricts the system to read 10 observations.

  4. None of the above.

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

The OUTOBS= option in PROC SQL restricts the number of rows in the output to the specified value. It limits what is displayed or written to the destination, not how many rows are read from the source. This differs from INOBS= (limits input) and FIRSTOBS= (sets starting observation).

Multiple choice technology programming languages
  1. Data fielda(5) type c

  2. Data fielda(5) type n

  3. Data fielda(5) type t

  4. Data fielda(5) type x

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

In ABAP, the 't' data type represents time and has a fixed length of 6 characters (HHMMSS). Defining type t with an explicit length like fielda(5) is invalid because its length cannot be customized, whereas 'c', 'n', and 'x' allow length specifications.

Multiple choice technology programming languages
  1. c&d

  2. a&d

  3. a&b

  4. c&b

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

For an internal table with a header line, 'CLEAR ITAB[]' clears only the body (the table content itself), while 'REFRESH ITAB' is the obsolete syntax equivalent to CLEAR ITAB[]. To clear only the body, use either 'CLEAR ITAB[]' or 'REFRESH ITAB[]' - options a and d.

Multiple choice technology programming languages
  1. AT USER-COMMAND

  2. AT PFn

  3. AT SELECTION-SCREEN

  4. END-OF-SELECTION

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

AT USER-COMMAND is triggered when toolbar function codes are clicked. AT PFn handles function keys, not toolbar buttons. AT SELECTION-SCREEN is for selection screen events. END-OF-SELECTION is an executable program event after data retrieval.

Multiple choice technology programming languages
  1. Open source general purpose

  2. Proprietary general purpose

  3. Open source special purpose

  4. Proprietary special purpose

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

PHP is an open source, general-purpose scripting language specifically designed for web development. It can be embedded directly into HTML code, making it ideal for creating dynamic web applications. The 'open source general purpose' description accurately captures both its licensing model and its versatility beyond just web development.