Interview MCQ Set 1
1. Calculations involving numbers are faster than those involving string.
a) True
b) False
Answer
Answer: a [Reason:] Numbers can be compared in a single operation while string comparisons involve several byte by byte or character by character comparisons. As the strings become longer, the performance gets poor.
2. To convert an int to string, the function is _________________
a) INET_ATON()
b) INET_NTOA()
c) INET_ITOS()
d) INET_STOI()
Answer
Answer: b [Reason:] In MySQL, the function used to convert an integer to a string is INET_NTOA(). On the other hand, the function INET_ATON() converts a string to the corresponding integer value.
3. To convert a string to an int, the function is _________________
a) INET_ATON()
b) INET_NTOA()
c) INET_ITOS()
d) INET_STOI()
Answer
Answer: a [Reason:] In MySQL, the function used to convert a string to an integer is INET_ATON(). On the other hand, the function INET_NTOA() converts a string to the corresponding integer value.
4. To maintain performance of tables having variable length rows, which statement is used?
a) MAINTAIN TABLE
b) BALANCE TABLE
c) ADJUST TABLE
d) OPTIMIZE TABLE
Answer
Answer: d [Reason:] In the variable length rows, there is more fragmentation of the table on which many deletes or updates are performed. OPTIMIZE TABLE is run periodically to maintain performance.
5. Which of these columns are faster?
Variable length, Fixed length
a) same
b) variable length
c) fixed length
d) indeterminate
Answer
Answer: c [Reason:] The fixed length columns are faster and take more space. CHAR(n) columns take n characters per value because the values are padded with trailing spaces when stored in the table.
6. Which of these take more space?
Variable length columns, Fixed length columns
a) variable length
b) same
c) fixed length
d) indeterminate
Answer
Answer: c [Reason:] In MySQL, the fixed length columns are faster and take more space. CHAR(n) columns take n characters per value because the values are padded with trailing spaces when stored in the table.
7. To minimize disk I/O, which of these should be chosen?
CHAR, VARCHAR
a) CHAR
b) VARCHAR
c) any one
d) either CHAR or VARCHAR
Answer
Answer: b [Reason:] In MySQL, because CHAR on average takes more space than VARCHAR, VARCHAR is preferred to be used to minimize the amount of the storage and disk I/O needed to process the rows.
8. Avoiding NULL in columns may make queries simpler.
a) True
b) False
Answer
Answer: a [Reason:] In MySQL, avoiding the NULL in columns may make the queries simpler, since it is not required to check for NULL as a special case. Simpler queries generally can be processed more quickly.
9. Which of these can be used to generate hash values?
a) MS5()
b) MA5()
c) MF5()
d) MD5()
Answer
Answer: d [Reason:] The hash values can be generated by using the function: MD5(). SHA1() or CRC32() can also be used to do the same. Custom hash values can also be created using logic within the application.
10. IP numbers can be represented as _________________
a) both integers and a string
b) a string but not integers
c) integers but not a string
d) neither a string nor integers
Answer
Answer: a [Reason:] The IP addresses like 192.168.0.1 can be either stored as a string or a group of integers. Both of these forms would have their own benefits. For example, storing as a string would facilitate pattern matching.
Interview MCQ Set 2
1. Copy constructor is a constructor which ________________
a) Creates an object by copying values from any other object of same class
b) Creates an object by copying values from first object created for that class
c) Creates an object by copying values from another object of another class
d) Creates an object by initializing it with another previously created object of same class
Answer
Answer: d [Reason:] The object that has to be copied to new object must be previously created. The new object gets initialized with the same values as that of the object mentioned for being copied. The exact copy is made with values.
2. The copy constructor can be used to:
a) Initialize one object from another object of same type
b) Initialize one object from another object of different type
c) Initialize more than one object from another object of same type at a time
d) Initialize all the objects of a class to another object of another class
Answer
Answer: a [Reason:] The copy constructor has the most basic function to initialize the members of an object with same values as that of some previously created object. The object must be of same class.
3. If two classes have exactly same data members and member function and only they differ by class name. Can copy constructor be used to initialize one class object with another class object?
a) Yes, possible
b) Yes, because the members are same
c) No, not possible
d) No, but possible if constructor is also same
Answer
Answer: c [Reason:] The restriction for copy constructor is that it must be used with the object of same class. Even if the classes are exactly same the constructor won’t be able to access all the members of another class. Hence we can’t use object of another class for initialization.
4. The copy constructors can be used to ________
a) Copy an object so that it can be passed to a class
b) Copy an object so that it can be passed to a function
c) Copy an object so that it can be passed to another primitive type variable
d) Copy an object for type casting
Answer
Answer: b [Reason:] When an object is passed to a function, actually its copy is made in the function. To copy the values, copy constructor is used. Hence the object being passed and object being used in function are different.
5. Which returning an object, we can use ____________
a) Default constructor
b) Zero argument constructor
c) Parameterized constructor
d) Copy constructor
Answer
Answer: d [Reason:] While returning an object we can use the copy constructor. When we assign the return value to another object of same class then this copy constructor will be used. And all the members will be assigned the same values as that of the object being returned.
6. If programmer doesn’t define any copy constructor then _____________
a) Compiler provides an implicit copy constructor
b) Compiler gives an error
c) The objects can’t be assigned with another objects
d) The program gives run time error if copying is used
Answer
Answer: a [Reason:] The compiler provides an implicit copy constructor. It is not mandatory to always create an explicit copy constructor. The values are copied using implicit constructor only.
7. If a class implements some dynamic memory allocations and pointers then _____________
a) Copy constructor must be defined
b) Copy constructor must not be defined
c) Copy constructor can’t be defined
d) Copy constructor will not be used
Answer
Answer: a [Reason:] In the case where dynamic memory allocation is used, the copy constructor definition must be given. The implicit copy constructor is not capable of manipulating the dynamic memory and pointers. Explicit definition allows to manipulate the data as required.
8. What is the syntax of copy constructor?
a) classname (classname &obj){ /*constructor definition*/ }
b) classname (cont classname obj){ /*constructor definition*/ }
c) classname (cont classname &obj){ /*constructor definition*/ }
d) classname (cont &obj){ /*constructor definition*/ }
Answer
Answer: c [Reason:] The syntax must contain the class name first, followed by the classname as type and &object within parenthesis. Then comes the constructor body. The definition can be given as per requirements.
9. Object being passed to a copy constructor ___________
a) Must be passed by reference
b) Must be passed by value
c) Must be passed with integer type
d) Must not be mentioned in parameter list
Answer
Answer: a [Reason:] This is mandatory to pass the object by reference. Otherwise the object will try to create another object to copy its values, in turn a constructor will be called, and this will keep on calling itself. This will cause the compiler to give out of memory error.
10. Out of memory error is given when the object _____________ to the copy constructor.
a) Is passed with & symbol
b) Is passed by reference
c) Is passed as
d) Is not passed by reference
Answer
Answer: d [Reason:] All the options given, directly or indirectly indicate that the object is being passed by reference. And if object is not passed by reference then the out of memory error is produced. Due to infinite constructor call of itself.
11. Copy constructor will be called whenever the compiler __________
a) Generates implicit code
b) Generates member function calls
c) Generates temporary object
d) Generates object operations
Answer
Answer: c [Reason:] Whenever the compiler creates a temporary object, copy constructor is used to copy the values from existing object to the temporary object.
12. The deep copy is possible only with the help of __________
a) Implicit copy constructor
b) User defined copy constructor
c) Parameterized constructor
d) Default constructor
Answer
Answer: b [Reason:] While using explicit copy constructor, the pointers of copied object point to the intended memory location. This is assured since the programmers themselves manipulate the addresses.
13. Can a copy constructor be made private?
a) Yes, always
b) Yes, if no other constructor is defined
c) No, never
d) No, private members can’t be accessed
Answer
Answer: a [Reason:] The copy constructor can be defined private. If we make it private then the objects of the class can’t be copied. It can be used when a class used dynamic memory allocation.
14. The arguments to a copy constructor _____________
a) Must be const
b) Must not be cosnt
c) Must be integer type
d) Must be static
Answer
Answer: a [Reason:] The object should not be modified in the copy constructor. Because the object itself is being copied. When the object is returned from a function, the object must be a constant otherwise the complier creates a temporary object which can die anytime.
15. Copy constructors are overloaded constructors.
a) True
b) False
Answer
Answer: a [Reason:] The copy constructors are always overloaded constructors. They has to be. All the classes have a default constructor and other constructors are basically overloaded constructors.
Interview MCQ Set 3
1. The loss of prestress due to elastic deformation of concrete depends on:
a) Modular ratio and average stress
b) Modular elasticity and shear
c) Prestress in concrete
d) Modulus of elasticity of steel
Answer
Answer: a [Reason:] The loss due to elastic deformation of concrete depends on the modular ratio and the average stress in concrete at the level of steel, consider a post tensioned member which is prestressed by a single tendon and the shortening of concrete occurs till the tendon is jacked and no shortening of concrete is observed after it.
2. The term Ec in losses developed by elastic deformation is expressed as:
a) Pe/A
b) Pc/Ea
c) P/AcEc
d) Ea/El
Answer
Answer: c [Reason:] The term Ec is defined as strain in concrete and the equation for loss due to elastic deformation is given as Ec = Pc/Ec = P/Ac×1/Ec, the tension in the tendon is obtained after the elastic shortening of concrete and therefore, there will not be losses due to elastic shortening.
3. The term Es in losses developed by elastic deformation is defined as:
a) Shear in steel
b) Torsion in steel
c) Strain loss in steel
d) Loading in steel
Answer
Answer: c [Reason:] The term Es is defined as strain loss in steel, Es = Δfs/Es,
Δfs = Loss of stress in steel, Es = strain loss in steel.
4. The loss of stress in steel due to elastic shortening or deformation is:
a) αefc
b) αcfc
c) αc/fc
d) αe/fc
Answer
Answer: a [Reason:] Loss of stress in steel due to elastic shortening is αefc,
αe = Es/Ec = modular ratio, fc = prestress in concrete at the level of steel, Es = modulus of elasticity of steel, Ec = modulus of elasticity of concrete.
5. A pretensioned concrete beam, 100mm wide and 300mm deep in prestressed by straight wires and modulus of elasticity of steel and concrete are 210 and 35n/mm2. Find modular ratio?
a) 14
b) 7
c) 6
d) 10
Answer
Answer: c [Reason:] b = 100mm, d = 300mm, Es = 210kn/mm2, Ec = 35n/mm2
αe = Es/Ec = (210/35) = 6n/mm2.
6. A pretensioned concrete beam 200mm wide and 300mm deep, is prestressed by straight wires carrying an initial force of 150kn at eccentricity of 50mm, area of steel wires is 188mm2. Find initial stress in steel?
a) 1400
b) 800
c) 200
d) 100
Answer
Answer:b [Reason:] b = 200mm, d = 300mm, p = 150kn = 150×103, e = 50mm, a = 188n/mm2,
Initial stress in steel = (150×103/188) = 800n/mm2.
7. A pre tensioned concrete beam 100mm wide and 300mm deep, initial force of 150kn at an eccentricity of 50mm, moment of inertia is 225×106mm4, initial stress in steel is 400n/mm2, modular ratio is 8. Estimate the percentage loss?
a) 10%
b) 5%
c) 14%
d) 20%
Answer
Answer: c [Reason:] P = 150kn, y = d/6 = 300/6 = 50mm, a = (100×300) = 3×104, I = 225×106, αe = 8, initial stress = 400n/mm2, Stress in concrete, fc = (150×103/3×104)+(150×103×50×50/225×106) = 6.66n/mm2,
Loss of stress due to elastic deformation of concrete = αefc = (8×6.66) = 53n/mm2,
Percentage of loss of stress in steel = (53×100/400) = 13.25% = 14%.
8. A rectangular concrete beam 360mm deep and 200mm wide, is prestressed by means of fifteen 5mm diameter wires located 65mm from the bottom of the beam and three 5mm wires, located 275mm from top of the beam, initial tension stress is 840n/mm2. Calculate prestressing force?
a) 504×102kn
b) 500×102kn
c) 620×102kn
d) 400×102kn
Answer
Answer: a [Reason:] Position of the centroid of wires from soffit of the beam y = ((15×65)+(3×25)/(15+3)) = 100mm, e = (150-100) = 50mm, area of concrete A = (200×300) = 6×104mm2, I = (200×3003)/12 = 45×107mm4, Prestressing force = initial stress×area = 840×6×104 = 504×105N = 500×102kn.
9. A post tensioned concrete beam, 100mm wide and 400mm deep is prestressed by three cables, each with a cross sectional area of 50mm2, initial stress of 1200n/mm2. Calculate the stress in concrete at level of steel?
a) 2.4n/mm2
b) 2.0n/mm2
c) 2.7n/mm2
d) 1.5n/mm2
Answer
Answer: c [Reason:] Force in each cable, p = (50×1200) = 60×103n = 60kn, A = 3×104mm2, I = 225×106mm4, e = 50mm, y = 50mm stress in concrete at the level of steel fc = (60×103/3×104)+(60×103×50×50/225×106) = 2.7n/mm2.
10. The loss of stress due to successive tensioning of curved cables in elastic deformation of concrete is estimated by considering:
a) Initial stress
b) Average stress
c) Bondage stress
d) Anchorage stress
Answer
Answer: b [Reason:] In most bridge girders, the cables are curved with maximum eccentricity in center of the span in such cases loss of stress due to elastic deformation of concrete is estimated by considering stress in concrete at the level of steel.
Interview MCQ Set 4
1. The datatype for single precision floating point number is ____________
a) FLOAT
b) DOUBLE
c) INT
d) BIGINT
Answer
Answer: a [Reason:] There are various numeric datatypes in MySQL. Some of them are TINYINT, SMALLINT, BIGINT, FLOAT, DOUBLE and BIT. ‘FLOAT’ is for single precision floating point numbers unlike DOUBLE.
2. Which datatype is used for a fixed length binary string?
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
Answer
Answer: b [Reason:] MySQL has a variety of string datatypes for use. Strings can hold arbitrary binary data. All the four options are string type names. BINARY is used for a fixed length binary string.
3. Which datatype means a variable length non binary string?
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
Answer
Answer: a [Reason:] In MySQL, there are a wide variety of string datatypes for use. Strings can even hold image and sound data. All the four options are string type names. VARCHAR represents a variable length non binary string.
4. Which data and time datatype stores time value in ‘hh:mm:ss’ format?
a) DATE
b) TIME
c) DATETIME
d) TIMESTAMP
Answer
Answer: b [Reason:] MySQL has some variety of date and time datatypes. These datatypes are crucial for representing records in a table. The ‘TIME’ type represents a time value, stored in the ‘hh:mm:ss’ format.
5. Which spatial datatype is used to store a curve?
a) GEOMETRY
b) POINT
c) LINESTRING
d) POLYGON
Answer
Answer: c [Reason:] In MySQL, there are many spatial datatypes available for use. Some examples are GEOMETRY, POINT, LINESTRING and POLYGON. The LINESTRING type is used to represent a curve.
6. How many of the following attributes are allowed only for numeric types?
UNSIGNED, ZEROFILL, CHARACTER SET, COLLATE
a) 1
b) 2
c) 3
d) 4
Answer
Answer: b [Reason:] UNSIGNED and ZEROFILL are allowable only for numeric types, and CHARACTER SET and COLLATE are allowable only for non-binary string types. These are type specific attributes.
7. A DEFAULT value cannot be supplied to spatial types.
a) True
b) False
Answer
Answer: a [Reason:] For every data type except the BLOB and TEXT types, spatial types, or columns with the AUTO_INCREMENT attribute, a DEFAULT def_value clause can be specified to keep a default value for a column.
8. A DEFAULT value cannot be supplied to TEXT types.
a) True
b) False
Answer
Answer: a [Reason:] The DEFAULT def_value clause can be specified for every data type except the BLOB and TEXT types, spatial types, or columns with the AUTO_INCREMENT attribute. The def_value holds the default.
9. The datatype INT stores ___________
a) 16 bit
b) 32 bit
c) 48 bit
d) 64 bit
Answer
Answer: b [Reason:] Numeric datatypes in MySQL are many. Each numeric datatype used in MySQL have their own ranges in terms of bits. The INT datatype stores signed and unsigned values of 32 bits.
10. The datatype SMALLINT stores ___________
a) 16 bit
b) 32 bit
c) 48 bit
d) 8 bit
Answer
Answer: a [Reason:] In MySQL, the numeric datatypes are many. A numeric datatype used in MySQL has its own range in terms of bits. The SMALLINT datatype stores signed and unsigned values of 16 bits.
Interview MCQ Set 5
1. The error log file has a suffix ______________
a) .err
b) .er
c) .error
d) .log
Answer
Answer: a [Reason:] In Windows, by default, the error log is located in the ‘C:Program FilesMySQLMySQL Server 5.7data’ directory. It is the file with a suffix of .err, or may be specified by passing in the ‘–log-error’ option.
2. The option which finds the startup options supported by the server through mysqld is ______________
a) –verbose
b) –vertex
c) –startup
d) –shutdown
Answer
Answer: a [Reason:] The statement ‘mysqld –verbose –help’ is used for finding out all the startup options that are supported by the server. It is possible to run the server manually or automatically.
3. Server startup can also be done by the ______________
a) option file
b) log file
c) error file
d) system file
Answer
Answer: a [Reason:] The options are listed in an option file. Options specified in this way are given one per line. Only the long option form can be used and it is written without the leading dashes.
4. For REVOKE statements, the server automatically rereads the grant tables.
a) True
b) False
Answer
Answer: a [Reason:] For the ‘REVOKE’ and ‘DROP USER’ statements, the server automatically re-reads the grant tables and no FLUSH PRIVILEGES statements are needed. Hence the grant tables are re-read.
5. It is required to have an access privilege for a database before selecting it with ‘USE’.
a) True
b) False
Answer
Answer: a [Reason:] In order to select a database as the default database for the MySQL server using the ‘USE’ statement, some access privilege for the database needs to be granted or attained.
6. The keyword used to create a database is __________
a) CREATE
b) SET
c) SETUP
d) LINK
Answer
Answer: a [Reason:] The statement ‘CREATE DATABASE database_name;’ is used to create a database with the name ‘database_name’. A database qualifier should be used to specify the full name of the database.
7. Which file is created by the server to store the database attributes?
a) db.otp
b) dp.zip
c) db.opt
d) db.cls
Answer
Answer: c [Reason:] Whenever a database is created in MySQL, the MySQL server creates a directory with the same name as the database. It creates the file db.opt to store the attributes.
8. What is the default storage engine?
a) EXAMPLE
b) ARCHIVE
c) MyISAM
d) NDB
Answer
Answer: c [Reason:] MySQL comes with multiple storage engines. The default storage engine used is ‘MyISAM’. ‘EXAMPLE’ is the stub storage engine, NDB is the storage engine for MySQL Cluster.
9. The name of the format file for a table named my_tbl is __________
a) my_tbl.fmt
b) my_tbl.frm
c) my_tbl.fmr
d) my_tbl.ftm
Answer
Answer: b [Reason:] Every time a table is created in MySQL, it creates a disk file containing the format of the table. It has two components, namely, base name (here, ‘my_tbl’) and an extension (here, ‘frm’).
10. In the CREATE TABLE statement the engine name specified is case insensitive.
a) True
b) False
Answer
Answer: a [Reason:] Suppose a table is created using the following statement: ‘CREATE TABLE my_tbl (…..) ENGINE = InnoDB;’. The engine name ‘InnoDB’ used is always case insensitive.