0

programming languages Online Quiz - 341

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

You develop a Windows-Based application that accesses a Microsoft SQL Server database named ABC. Users must supply a user name and password when they start the application. This information is then used to dynamically build a connection string. When you test the application, you discover that it is not using the SqlClient connection pooling feature. You must reduce the time needed to retrieve information. How should you modify the connection string?

  1. to use the Windows user logon when connection to the TestKing1 database.

  2. to use the SQL Server used login when connection to the TestKing1 database.

  3. to use the same application logon ID and password for every connection to the TestKing1 database.

  4. to use the guest login ID and password for every connection to the TestKing1 database.


Correct Option: C

You develop a Windows-based application that contains a form named ContactABC. You need to write code to initialize all class-level variables in ContactABC as soon as ContactABC is instantiated. You will place your code in a public procedure in the ContactABC class. Which public procedure should you use?

  1. Create

  2. Initialize

  3. Load

  4. New


Correct Option: D

AI Explanation

To answer this question, you need to understand the purpose of each public procedure in the ContactABC class. Let's go through each option to understand why it is correct or incorrect:

Option A) Create - This option is incorrect because the "Create" procedure is not a valid public procedure in the ContactABC class.

Option B) Initialize - This option is incorrect because the "Initialize" procedure is not a valid public procedure in the ContactABC class.

Option C) Load - This option is incorrect because the "Load" procedure is typically used to load data or perform initialization tasks when a form is loaded, not when the ContactABC class is instantiated.

Option D) New - This option is correct because the "New" procedure is a valid public procedure in the ContactABC class. It is called when a new instance of the ContactABC class is created, allowing you to initialize class-level variables at that time.

The correct answer is D) New. This option is correct because it allows you to initialize all class-level variables in ContactABC as soon as it is instantiated.

You use Visual Studio .NET to create several Windows-based applications. All use a common class library assembly named ABCCustomers. You deploy the application to client computers on your company intranet. Later, you modify ABCCustomers.Any application that uses version 1.0.0.0 must now user version 2.0.0.0. What should you do?

  1. Modify the machine configuration file on your client computers.

  2. Modify the application configuration file for Customers.

  3. Modify the Publisher Policy file containing a reference to Customers.

  4. Modify the reference patch for Customers.


Correct Option: C

You develop a Windows-based application ABCApp by using Visual Studio .NET. ABCApp uses a SqlConnection object for database access. You typically run ABCApp on a computer that has limited RAM and hard disk space. After the code finishes using the SqlConnection object, you must ensure that the connection is closed and that any resources consumed by the object are released immediately. What should you do?

  1. Call the Finalize method of the SqlConnection object.

  2. Call the Dispose method of the SqlConnection object.

  3. Set the SqlConnection object equal to Nothing.

  4. Set the SqlConnection object equal to “”.


Correct Option: B

You use Visual Studio .NET to develop a component named ABCComponent. You plan to develop several client applications that use ABCComponent. You need to deploy ABCComponent with each of these applications. You will create a distribution package to be included with each application. Which type of project should you create?

  1. CAB project.

  2. merge module project.

  3. setup project.

  4. Web setup project.


Correct Option: B

You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?

  1. ALTER TABLE students ADD PRIMARY KEY student_id;

  2. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY(student_id);

  3. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

  4. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

  5. ALTER TABLE Students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);


Correct Option: D
Explanation:

To solve this problem, the user needs to know the SQL syntax for adding a primary key to a table using the ALTER TABLE statement.

A primary key is a column or set of columns that uniquely identifies each row in a table. It is a constraint that ensures that the values in the column(s) are unique and not null.

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

A. ALTER TABLE students ADD PRIMARY KEY student_id;

This statement is incorrect because it is missing the keyword "CONSTRAINT". The correct syntax for adding a primary key constraint is "ADD CONSTRAINT".

B. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY(student_id);

This statement is incorrect because it is missing the name of the constraint. All constraints should have a unique name for easy identification and management.

C. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

This statement is incorrect because the syntax is wrong. The correct syntax for adding a primary key constraint is "ADD CONSTRAINT PRIMARY KEY ()".

D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

This statement is correct. It adds a primary key constraint named "stud_id_pk" to the "students" table on the "student_id" column.

E. ALTER TABLE Students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

This statement is incorrect because it uses the "MODIFY CONSTRAINT" syntax, which is not valid for adding constraints.

Therefore, the correct answer is:

The Answer is: D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

For Which two constraints does the Oracle server implicitly create a unique index? (Choose Two)

  1. NOT NULL

  2. PRIMARY KEY

  3. FOREIGN KEY

  4. CHECK

  5. UNIQUE


Correct Option: B,E

Which two statements about views are true? (Choose two)

  1. A view can be created as read only.

  2. A view can be created as a join on two or more tables

  3. A view cannot have a n ORDER BY clause in the SELECT statement.

  4. A view cannot be created with a GROUP BY clause in the SELECT statement.


Correct Option: A,B

Which three are DATETIME data types that can be used when specifying column definitions? ( Choose Three)

  1. TIMESTAMP

  2. INTERVAL MONTH TO DAY

  3. INTERVAL DAY TO SECOND

  4. INTERVAL YEAR TO MONTH

  5. TIMESTAMP WITH DATABASE TIMEZONE


Correct Option: A,C,D

Which data dictionary table should you query to view the object privileges granted to the user on specific columns?

  1. USER_TAB_PRIVS_MADE

  2. USER_TAB_PRIVS

  3. USER_COL_PRIVS_MADE

  4. USER_COL_PRIVS


Correct Option: D

ORA-01403 Means?

  1. No data found

  2. Internal error

  3. TNS:could not resolve service name"

  4. None of the above


Correct Option: A

ORA-01017 ?

  1. Oracle not available (the database is down)

  2. Invalid Username/Password

  3. Snapshot too old (Rollback has been overwritten)

  4. Unique constraint violated


Correct Option: B

ORA-00001 Means?

  1. PL/SQL Error

  2. No data found

  3. Insufficient privileges

  4. Unique constraint violated. (Invalid data has been rejected)


Correct Option: D

ORA-00001 Means?

  1. PL/SQL Error

  2. No data found

  3. Insufficient privileges

  4. Unique constraint violated. (Invalid data has been rejected)


Correct Option: D

From the following code fragments select the most appropriate way of throwing exceptions ?Assume that variable i is properly defined , in scope and has appropriate value

  1. if ( i > 10) { throws new IndexOutOfBoundsException("Index is out of bound!"); }

  2. if ( i > 10) { throw new IndexOutOfBoundsException("The value of index i=" + " is out of bound!" ); }

  3. if ( i > 10) { throw "Index is out of bound!"; }

  4. None of the ABove


Correct Option: B

ORA-03114 Means?

  1. Not connected to ORACLE

  2. Table or view does not exist

  3. Internal error (contact support)

  4. None Of The Above


Correct Option: A

ORA-03114 Means?

  1. Not connected to ORACLE

  2. Table or view does not exist

  3. Internal error (contact support)

  4. None Of The Above


Correct Option: A

ORA-12154 Means?

  1. TNS:name lookup failure"

  2. TNS:could not resolve service name"

  3. TNS:protocol adapter error"

  4. Package error raised with DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR


Correct Option: B
- Hide questions