0

programming languages Online Quiz - 125

Description: programming languages Online Quiz - 125
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

C++ provides facility to specify that the compiler should match function calls with the correct definition at the run time. This process is called as

  1. Static binding

  2. Dynamic binding

  3. -

  4. --


Correct Option: B

In Java, to copy the contents of a to a new Foo object b

  1. Foo b = a;

  2. Foo b = a.clone();

  3. Foo b;b=a;

  4. -


Correct Option: B

In C++, this pointer is used by the symbol___

  1. . (dot)

  2. ,

  3. ->

  4. >


Correct Option: C

C++ is normally compiled directly to machine code which is then executed directly by the operating system

  1. True

  2. False


Correct Option: A

In Java ,the statement Foo d = c; binds d to reference the same object as c, what will be equivalent statement in C++

  1. Foo d = c;

  2. Foo *d = c;

  3. Foo d; d=c;

  4. --


Correct Option: B

A Cartesian product is returned when

  1. join conditions are not specified in a PROC SQL join.

  2. join conditions are not specified in a PROC SQL set operatio

  3. more than two tables are specified in a PROC SQL join.

  4. the keyword ALL is used with the OUTER UNION operator.


Correct Option: A

Which statement about the following PROC SQL query is false? proc sql; validate select name label=’Country’, rate label=’Literacy Rate’ from world.literacy where ’Asia’ = (select continent from world.continents where literacy.name = continents.country) order by 2;

  1. The query syntax is not valid.

  2. The outer query must pass values to the subquery before the subquery can return values to the outer query.

  3. PROC SQL will not execute this query when it is submitted.

  4. After the query is submitted, the SAS log will indicate whether the query has valid syntax.


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The query syntax is not valid - This option is correct because the given PROC SQL query contains invalid syntax. The issue lies with the use of single quotes around the column labels in the SELECT statement. In PROC SQL, column labels should be enclosed in double quotes, not single quotes. Therefore, this statement is false.

Option B) The outer query must pass values to the subquery before the subquery can return values to the outer query - This option is incorrect. In the given query, the subquery is used to retrieve the continent value based on the condition literacy.name = continents.country. The outer query then uses this value to filter the records from the world.literacy table. The subquery does not depend on the outer query for values.

Option C) PROC SQL will not execute this query when it is submitted - This option is incorrect. PROC SQL will execute the query when it is submitted, regardless of whether the syntax is valid or not. However, if there are syntax errors, the query may not produce the desired results.

Option D) After the query is submitted, the SAS log will indicate whether the query has valid syntax - This option is correct. After submitting the query, the SAS log will display information about the execution, including any syntax errors that may be present.

The correct answer is A) The query syntax is not valid because the single quotes around the column labels in the SELECT statement are incorrect.

  1. the tables being joined must contain the same number of columns.

  2. the tables must be sorted before they are joined

  3. the columns that are specified in a join condition in the WHERE clause must have the same data type.

  4. the columns that are specified in a join condition in the WHERE clause must have the same name.


Correct Option: C

A PROC SQL inner join can combine

  1. a maximum of 2 tables or in-line views, but multiple joins can be chained together.

  2. a maximum of 32 tables or 2 in-line views.

  3. a maximum of 32 tables, which includes any tables referenced by an in-line view.

  4. a maximum of 2 tables and 32 columns.


Correct Option: C

Which PROC SQL query will remove duplicate values of MemberType from the query output, so that only the unique values are listed?

  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;


Correct Option: D

Bonus dataset ID Bonus 123 5000 456 7000 744 3500 Salary Dataset ID Salary 123 70000 456 80000 978 55000 Given the PROC SQL query and tables shown below, which output is generated? proc sql; select s.*, bonus from bonus as b right join salary as s on b.id= s.id;

  1. ID Salary Bonus 123 70000 5000 456 80000 7000 978 55000 3500

  2. ID Salary Bonus 123 70000 5000 456 80000 7000 744 . 3500

  3. ID Salary Bonus 123 70000 5000 456 80000 7000 744 55000 3500

  4. ID Salary Bonus 123 70000 5000 456 80000 7000 978 55000 .


Correct Option: D

Which statement about the use of table aliases is false?

  1. Table aliases must be used when referencing identical table names from different libraries.

  2. Table aliases can be referenced by using the keyword AS.

  3. Table aliases (or full table names) must be used when referencing a column name that is the same in two or more tables.

  4. Table aliases must be used when using summary functions.


Correct Option: D

Which of the following will cause PROC SQL to list rows that have no data in the Address column?

  1. WHERE address is missing

  2. WHERE address not exists

  3. WHERE address is null

  4. both a and c


Correct Option: D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

A. WHERE address is missing - This option is incorrect because the keyword "missing" in PROC SQL is used to check for missing numeric values, not missing character values. Therefore, it will not list rows that have no data in the Address column.

B. WHERE address not exists - This option is incorrect because the keyword "not exists" is used in SQL to check for the existence of a specific value or condition in a subquery, not to check for missing data in a column.

C. WHERE address is null - This option is correct. The keyword "is null" is used in SQL to check for missing data in a column. It will list rows that have no data in the Address column.

D. both a and c - This option is correct. Both "WHERE address is missing" and "WHERE address is null" will list rows that have no data in the Address column.

Therefore, the correct answer is D. This option is correct because both "WHERE address is missing" and "WHERE address is null" can be used to list rows that have no data in the Address column.

You are creating a PROC SQL query that will list all employees who have spent (or overspent) their allotted 120 hours of vacation for the current year. The hours that each employee used are stored in the existing column Spent. Your query defines a new column, Balance, to calculate each employee’s balance of vacation hours. Which query will produce the report that you want?

  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;


Correct Option: B

/de{0,3}/ matches

  1. df

  2. def

  3. deef

  4. deeef

  5. all the above


Correct Option: E

To copy entire matched sequence

  1. $&

  2. $%

  3. $_

  4. $@

  5. $^


Correct Option: A

$input = “abdce” =~ tr/abc/123 print $input;

  1. 123

  2. 123ce

  3. Cant modify constant item in translation

  4. 12d3e

  5. None of the above


Correct Option: C

$string = “\uhello world!”; print $string; $string = “\Uhello world!”; print $string;

  1. Hello world HELLO WORLD.

  2. Hello World HELLO WORLD.

  3. Hello world HELLO world.

  4. hello world HELLO WORLD.


Correct Option: A

package A; sub new { return bless {}, shift; } sub DESTROY { print ref(shift); } package B; use base 'A'; sub DESTROY { my $self = shift; print ref($self); bless $self, 'A'; } package main; my $obj = B->new();

  1. BA

  2. AB

  3. Compilation Error

  4. Null point reference error


Correct Option: A
- Hide questions