Quiz
Quiz
Association
Aggregation
Composition
34. A company wants to maintain their employees information along with their payroll details. Employees can be
PermanentEmployee or ContractEmployee. The departments in the company are also maintained. The salary for
the employee is calculated using a helper class.
From the given scenario, the classes identified are
• Employee
• PermanentEmployee
• ContractEmployee
• Department
• PayrollCalculator
Identify the relation between the
• Employee and Department
• Employee and PermanentEmployee
• Employee and PayrollCalculator
Employee and PermanentEmployee Inheritance
Employee and Department Association
Employee and PayrollCalculator Dependency
35. Match the right methods for the numbers specified in the sequence diagram. Use the class diagram given below
to complete the task.
1 → validCustomerDetails(custDetails)
2 → initiateCustomer(custDetails)
3 → registerCustomerDetails(custDetails)
4 → generateCustomerID()
5 → create
6 → addCustomertoDB(customer)
7 → Customer
8 → displayCustomerDetails(Customer)
36. Activity diagram does not contain _______.
attributes
37. In Activity diagram, Fork is used to represent ________.
Concurrent flow
38. Who is an actor?
An actor is a user, who interacts with the system.
39. What is the type of relation between Cycle and Bi-cycle?
Generalization
40. Which UML model depicts the interactions between the objects by passing series of messages?
sequence diagram
41. In statechart diagram, the objects state is changed because of _________.
event
42. Activity diagram:
represents the flow of control from activity to activity.
43. Which notation in sequence diagram is used to represent the period of time the object is active?
Focus of control
44. Identify the missing usecase that is part of bill calculation from the scenario
Discount Calculation
45. Identify, whether there is a relation between bill generation and cancel/postpone if present what type of
relation from the given scenario
include
46. Is the given usecase diagram correct for the given scenario
False
47. In a library there are many books and members register themselves with their name, age, address and if staff
with staffid, department or if student then regno, year. Registered members can borrow the book. The details of
the books been borrowed by the members are also maintained. Every time a member borrows a book the return
date is calculated. If the date of return by the member is beyond the return date, then a penalty is calculated.
The difference in date and the return date are calculated using a helper class methods
For the given scenario identify the classes.
Member, Staff, Student, Book, Transaction, DateCalculator
48. Complete the sequence diagram.
Classes present
Software Engineering Fundamentals
Software Engineering Fundamentals
1. Transition from what phase to how is implemented in ---------- phase of SDLC
Design
2. ________ deals with transforming the customer requirements, into a set of documents that is suitable for
implementation in a programming language.
System design
3. The goal of system analyst is to determine where the problem is, in an attempt to fix the system.
True
4. Unit testing is performed by ………..
Developer
5. Allen company got a project to be done from scratch. They decided to follow the below steps analysis design
coding testing. This constitutes ….
SDLC
6. The student mark processing system software has been developed and deployed at the StPeter's University. The
system shows the grade as 0 for all the students rather than the actual grade. Which below phase was not done
properly during SDLC
Software testing
7. The software is put into operation in the clients environment. Client comes back to enhance the UI to attract
more customers. This is ------------- project
Maintenance
8. ------------- does not involve in the source code execution
validation
9. Which confirms that the software meets its technical specifications?
verification
10. In evolutionary prototype model unstable requirements are prioritized and code is developed initially for the
unstable requirements then foe the stable requirements
False
11. In which model, Testing is done from the earlier stage thereby brings high quality into the development of our
products.
V-model
12. The client wants the UI Screen in their company logo color. The developer is not very sure about the color which
the client is expecting, in this scenario which model be the right model that can be used?
Prototype model
13. ______ is a linear sequential model, systematic in approach and the principle of this model suggests - "Can't
retrieve to the previous phase”
Waterfall model
14. The KK department is doing few activities manually for the past 10 years. The department has decided to
automate the same activities to improve profitability. Which model would be best suited for the above scenario
Waterfall model
15. ________ prioritizes requirements of the system and implements them in groups.
Incremental model
16. The RAD model follows a component based approach.
True
17. ________ is not suitable for large projects because they require more manpower for creating multiple RAD
groups.
RAD
ABC company comes to the Allen Software Company with various requirement. The client wants the
functionality to view all the employee profile, view salary information of the employee and view the leave
details.Once each functionality is completed the module will be delivered to the client. Which would be the right
model for this scenario
Incremental model
A client wants to develop a Web application for the new Super market store. The client want to have lot of UI
components and customers will have lot of interactions with the UI. What model is best suited
Prototype
Spiral life cycle model is not suitable for products that are vulnerable to large number of risks. State if True or
False.
FALSE
When there is a difference between the output what is expected and the actual one is termed as……
Defect
XYZ Finance Co. has, at present, started its operations in India. Based on the first six months performance, it has
plans for expansion across five countries. They want to automate their operations at this stage. What is the
process model that the developer should choose to adopt?
When the requirements are unclear use the Throw away prototype and when the requirements are unstable use
the evolutionary prototype
When the requirements are unstable → Use the Evolutionary prototype,
When the requirements are unclear → Use the Throw away prototype
Arrange the steps / activities involved in the process of prototyping
Match the phases of the Rapid Application Development model against their objectives
Business modeling - information flow between various modules, Data modeling - define data objects, Process
modeling - CRUD of data objects are determined, Application generation - convert process models into the
actual system,Testing and turnover - new components are tested
generation → Automated tools are used to convert process models into the actual system,
Data modeling → Information gathered from business modeling is used to define data objects,
Testing and turnover → New components along with all the interfaces are tested,
Business modeling → The information flow is identified between various modules,
Process modeling → Data objects are converted to achieve the business objective
High-risk or major functions are addressed in the first cycles there by delivering an operational product. Which of
the SDLC process models achieves this?
High-risk or major functions are addressed in the first increment cycles and each release delivers an operational
product
Incremental model
Beta technologies has undertaken a collision avoidance system software to be implemented for airports.
Additional safety measures have to be automated by warning pilots when another aircraft gets closer, otherwise
impacts are huge. Which of the following SDLC process models best suits the requirement?
Spiral model is used when risks perceived is high
Spiral model
The student mark processing system software has been developed and deployed at the St. Peters university.
The system shows the grade as 0 for all the students rather than the actual grade. Which phase below was not
done properly during the SDLC?
Software Testing
Arrange the phases of Water fall model
• Requirement Gathering
• Analysis
• Design
• Implementation
• Testing
• Deployment
• Maintenance
Testing performed by the user to ensure that the system meets the agreed upon quality attributes and the
specification is called as….
Acceptance testing
Match the correct E,T,V,X (Entry,Task,Verify,Exit) criteria for the below scenario
Scenario: LIC has manually carried out their process of premium collection procedure for the past 45 years.
Now, they have employed the services of another company to automate the above.
Question: Which of the following models would you suggest to the outsource company?
Waterfall model
Which model emphasizes Validation and Verification at each level of stage containment?
Validation and Verification at each level of the stage containment is emphasized in V Model
V-Model
Consider that you have to develop a flight control system. The system is simulated as such that the original
system is working. There are many potential hazards with such a system. What model would you suggest to
develop the system?
Spiral model
_________ is the application of a systematic, disciplined, quantifiable approach to the design, development,
operation and maintenance of software.
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the design,
development, operation and maintenance of software
Software Engineering
Requirement came to Allen Software company to develop a software for military purpose. .00001 second delay
in the missle launching software would create greater loss to the human life. What kind of model is best suited
for this scenario
Spiral model
During which phase the following activties are identified:Identifying the major modules of the system, how
these modules integrate, the architecture of the system and describing pseudocode for each of the identified
module
Design
_______ describes how the development activities will be performed and how development phases follow each
other.
Software Development Process describes how the development activities will be performed and how
development phases follow each other
Software Development Process
Aesthetics of the website is part of the functional requirement. State true or false
FALSE
Which of the following options are the steps involved in Requirements Analysis?
Requirements Analysis → Analyzing the customer and the user/stakeholder to arrive at a definition of software
requirements,
Arrange the activities of the Requirements Engineering phase and the Design phase
• Requirements Elicitation
• Requirements Analysis
• Requirements Specification
• High Level Design
• Low Level Design
Identify the type of design that helps in transforming the data model created during requirements analysis phase
into the data structures that will be used to implement the software
Data Design helps in creating the data architecture for a system to represent the data components
Data Design
Match the objectives of the types of design involved
Architecture design defines the modules of the system and the functions that each module perform
The interface design describes how the software communicates with itself, and with the users interacting with
the software
Low Level Design focuses on writing a detailed algorithm
Interface design → Describes how the software communicates with itself, and with the users interacting with
the software,
Architecture design → Defines the modules of the system and the functions that each module perform, Low
Level Design → Focuses on writing a detailed algorithm
The order of activities performed by a System Analyst are,
[Understand ] users requirement
[Collects data needed for ] user requirement
[Writes ] software requirement specification
Consider the below scenario. A team has many players and the player belongs to one team. Identify
the cardinality between player and team
M:1
What kind of non functional requirement best suit the below scenario? Whenever the new offers are published in
the online shopping site, an sms has to be sent to all the registered customers within 10 minutes of publishing.
Performance requirement is one of the non functional requirements
Performance Requirement
Choose the correct type of testing for the given Scenario
Testing to test the GUI components in the screen → Usability Testing,
Testing to check if 1000000 users accessing website at the same point of time → Load Testing,
Testing to check if the report is generated within 5 sec on click of the button as agreed in the SRS →
Performance Testing,
Testing to check if the card is swiped for more than three times with wrong pin, the card has to be blocked →
Security Testing
Which of the following are available in SRS Document?
SRS document includes sections for Functional Requirements, Non Functional Requirements, and Constraints
Functional Requirements, Non Functional Requirements, Constraints
Identify the possible entities from the given option
Customer, Sale
Whenever a new product is arrived, the stock needs to be updated. This requirement is an example for non
functional requirement. State true or False
FALSE
Basics Of Testing
Client Comes to Allen Company for a Banking Solution.Which phase of SDLC is best suited to gather what is
expected from client?
Requirement analysis
The standard document that describes all the requirements of the system is called as .............
The standard document that describes all the requirements of the system is called as Software Requirement
Specification
Software Requirement Specification
In remote control Car application, in the step by step execution of the requirement described, it is mentioned
when the fuel level goes below the minium level, the application should indicate the user in red color. In the
output section of the same process it is mentioned that the indicator will glow pink. What is the kind of
requirement specified in SRS
Contradicting
An SRS has the following requirement.The stock exchange shall show the stock report for the next 24
hours.What is the issue with this requirement
Ambiguous
A good SRS should be ______, ________ and _______.
Traceable, Consistent, Complete
Client Comes to Allen Company for a Banking Solution. Who from the below options would be best suited to
gather all the requirements correctly from the client?
A System Analyst understands the users requirements, and collects or gathers the required data
System analyst
Identify this technique of dynamic testing where, For a range of input, three values are chosen, One value above
the range, One value below the range, and One value within the range
Equivalence class partitioning divides the input domain into classes of data from which test cases can be
derived
Equivalence partitioning
What is the difference between the actual output of a software and the correct output?
Error – is the difference between the actual output of a software and the correct output
Error
Match the objectives of the phases of Software Testing Life Cycle
Test Plan→ Resource allocation, creation of test environment, test schedule and test functionality,
Test Execution→ Executing test scripts and Finding bugs,
Test Design→ Test scenarios, test cases, test data, and test scripts are prepared
Arrange the phases of Software Testing Life Cycle
• Test plan
• Test Design
• Test execution
• Report to developer
• Verify and close
Statement Coverage,
Condition or Branch Coverage,
Loop Coverage
After implementation of Library management system, the tester identified that certain logic are redundantly
rewritten by the developers, and the coding standards are violated in few modules. What type of testing is
carried out to identify these errors?
Static Testing is a software testing method where the code of the software and the work products, that is, the
associated documents are observed and tested manually to find errors
Static Testing
Tester is trying to test whether the values in the drop down are listed properly.
What type of testing the tester performs in this scenario?
In Black box testing functionality of the software is tested and not the internal implementation of the code
Black box testing
In the online shopping portal, for customer registration the password field can accept only characters in the
range of 5 to 25. Derive test cases using Boundary value analysis
5,25,4,26
Walk through is performed by the trained moderator, whereas the Inspection is usually conducted by the author
itself to record defects and deviations
False
The testing technique that deals with the internal logic and structure of the code is called ________.
WhiteBox Testing
Determine the cyclomatic complexity for the following
code: Accept year
if(year mod 4=0 and year mod 100!=0) or(year mod 400 =0)
print year is leap
else
print year is not leap
end if.
4
Boundary value analysis can only be used during white-box testing. State if True or False.
FALSE
Software Maintenance
Which maintenance includes all efforts to refine the quality of the software or the document?
Perfective Maintenance includes all efforts to polish or refine the quality of the software or the document
Perfective Maintenance
Match the scenarios against the types of Maintenance
The fare details are updated in the Railway reservation software to reflect the increase in fare → Adaptive
Maintenance,
Client comes back for a change to be made in the Billing report getting generated due to incorrect rounding of
amount → Corrective Maintenance,
The UI of the managetrip.com is refined to include more options for Booking tickets and venues → Perfective
Maintenance
Arrange the steps involved in the Maintenance process
• Impact Analysis
• System release planning
• Change Implementation
• System release
• When a change request comes, Change Control Board first does an impact analysis and does the system
release planning. The changes are then implemented and released.
Identify the correct facts about Maintenance
It is affected by both technical and non technical factors, Aging software can have high support costs
Match the terms involved in Maintenance and its objectives
Software re-engineering → New functionalities are not added to the system but it is restructured and
reorganized,
Architectural transformation → The system is modified from a centralized to a distributed platform,
Software maintenance → Changes are made in response to changed requirements but the fundamental
software structure is stable
RBI has slashed the interest rate from 8% to 7% on all the loans that banks offer. What kind of maintanence has
to be carried out on the banking applications to accommodate this change
Adaptive Maintenance
Help option provided in the online shopping portal has minimal inputs about the application navigation. Client
wants Allen software company to include advanced help options to better serve their customers. What kind of
maintenance best suits the above scenario
Perfective Maintenance
The customer comes back to Allen software company stating that when more than 'n' users simultaneously hit
the website at the same time for customer registration , the application failed to generate the customerid
correctly.What kind of maintanence best suit the given scenario
Corrective Maintenance
State true or false.Well documented and well structured software are difficult to maintain
FALSE
When a system is restructured and reorganized to facilitate future changes, it is called as _________.
Software re-engineering
Which of the following options are valid for the relationship between the configuration objects?
A curved arrow indicates a compositional relation.
A double-headed straight arrow indicates an interrelationship.
Version Control allows users to lock files so they can only be edited by one person at a time and track changes
to files
Version control is a mechanism used to manage multiple versions of files
True
Which of the following describes the change history of an object?
Evolution graph
_________ is a committee that makes decisions regarding whether or not proposed changes to a software project
can be incorporated.
Change Control Board
State true or false. Automated tools are available in the market, for managing change and versioning the
software
TRUE
John bought a new Laptop with a high end configuration. To protect his laptop and the applications installed he
Preventive
installed a antivirus software.This is an example for Maintenance
Preventive
From the options identify the features that are part of the software configuration management
Version management, Concurrency control, Synchronisation control
baseline
The entry door of the Server room inside the company can be considered as equivalent to concept in
configuration management.
Baseline
Version Management allows parallel concurrent development. State True or False.
True
Match the correct option
The standard document where the requester fills the change in the change management process → Change
Request Form,
Process that ensures different versions of the project is managed → Configuration Management,
Who authenticates that the change proposed is valid → Change Control Board,
Process that ensures that changes made are recorded and controlled → Change Management
State true or false. During agile development more emphasize is given for documentation
FALSE
Which of the following agile methodologies depends on the cohesiveness of the team and individual
commitment of the team members?
Lean Software Development
Which agile methodology divides the development into sprint cycles, in which a Specified set of features are
delivered? Choose from the following:
SCRUM
What are the roles in dynamic system development method? Choose from the following:
Scribe Facilitator, Technical Coordinator
__________ is an iterative and incremental approach that embraces principles of agile development, including
continuous user/customer involvement.
Dynamic System Development Method
Computer teacher has advised her student that before starting coding you always need to follow the below
activities: Analyse the requirement, write pseduocode then code the same.
From the above scenario, identify the apt keyword from below the teacher is trying to make her students
follow
process
A is a set of programs, procedures and its documentation concerned with the operation of a data processing system.
software
In Ad-hoc software development, the process to be followed is unpredictable and can be changed over time as the
product development progress.
true
Software engineering is the application of a systematic, disciplined, quantifiable approach to the design,
development, operation, and maintenance of software.
True
Requirements elicitation
______ is the process of establishing the services the system should provide and the constraints under which it must
operate.
Requirement analysis
During which phase the cost constraints, time constraints, practical difficulty of the project to be implemented and
resources are analysed?
Feasibility study
Entity represent
False
Entities
Testing is the process to identify differences between expected and actual results.
True
Test Plan
Test Design
Test Environment
Resource Allocation
defects
Unit
Acceptance
Which testing is used to check whether a particular module is implementing its specification.
Unit
Testing that checks both functional and non functional aspects of the system to ensure that the system works as per
the agreed specifications is called as .....
System testing
Two modules are developed customerRegisteration and viewProducts. Customer was unable to choose his city field
while registering, this is a bug.Now after the Bug is fixed by the Development team, the Testing team checks that,
fixed bug does not affect other modules. What type of testing is performed?
Regression testing
True
Inspection involves step by step reading of the product, with each step checked against a predefined list of criteria.
True
_______ testing is the testing of the software work products manually to find errors.
Static
During System testing ...... kind of testing is performed to check that the system adheres to the agreed requirement
specification
Black box
Equivalence class and Boundary value analysis can be used to test during all levels of testing
True
White-Box testing does not deals with the internal logic and structure of the code.
False
Maintenance done to correct the existing errors found in the software when the software is used for longer time is
called as -------- maintenance
Corrective
Changes done to add new features or to improve the look and feel of the software is maintenance _____.
Perfective
Storage web site was designed by Allen team. Initially 5GB was allocated to each user who is registered with the
website. As users started to use the storage heavily and anticipating storage shortage might happen the client wants
to do increase the storage capacity. What kind of maintenance should be carried out
Preventive
Maintenance cost will be higher than the development cost or both cost will be equal.
True
Maintenance that involves in platform change or policy change or standards is- maintenance kind of
Adaptive maintenance
Document that is technically reviewed and formally approved by CCB and can make changes only after a formal
approval process is called as
Baseline
Configuration management is required only during the development phase.State true or false
False
An Aggregate
False
_________ helps to ensure that parallel changes, performed by two different people, don't overwrite each other.
Synchronization Control
An operation used to make a developer's object version available to other users is called
check in
True
________ divides the development into short cycles called sprint cycles
Scrum
True
Scrum
Training for both developers and the users is required this is one of the drawback of DSDM.
True
Yellow
Orange
In which methodology the team must hold both pre- and post- reflection with a strong preference for mid-project
reflection workshops?
Crystal
Feature driven development (FDD) is a short iteration framework for software development.
True
XP
"Technical Environment with Automated Tests, Configuration Management, and Frequent Integration is the property
of ______ methodology."
Crystal
True
XML AND JSON
1. What is the correct syntax in HTML for creating a link on a webpage?
<a herf=”mcqsets.html”
2. What are the new features in HTML5?
New form controls like calendar, date, time, email, URL, search
Better support for local storage
Video and audio elements are available for media playback
Canvas element is provided for 2D drawing
3. ____________ is the HTML5 attribute that specifies a regular expression against which the field should be
validated.
pattern
4. ___________ is an HTML5 element, which is used to specify multiple media resources for media elements like
audio and video.
source
5. Within a table cell <td>:
<form></form>
<ol></ol>
<table></table>
<p></p>
All tags could be used
6. State True or False.
Is the following XML fragment a well-formed one?
<?xml version="1.0"?>
<data>
<name>Sandy</name>
<location coast-west>California</location>
<dateofjoin>07/05/2001</dateofjoin>
</data>
False
7. Which of the following options are best suitable for an XML document?
It is a platform independent way to represent data
All of the leading methods of Web services, SOAP, REST, and even XML-RPC, are based on XML
It is a W3C Standard to complement HTML
8. Which one of the following options are best suitable for an XML document?
XML tags are case sensitive
XML elements must be properly nested
XML documents must have a root tag
9. _________ validates the xml document against the schema/dtd.
Parser
10. _________ schema tag allows to specify elements in any order.
all
11. _________ schema tag is used to specify the order in which the tags should appear.
Sequence
12. While declaring an element using XSD schema <xsd:element...>, the default values of minOccurs and maxOccurs
are --------- and --------- respectively.
1,1
13. State True or False.
Reusable schemas can be created by including parts of other schemas or even whole schemas into a parent
schema
True
14. State true or False.
JSON structure is same for all the languages.
True
15. Which of the following datatypes are supported by JSON?
Number
String
Object
16. State true or False.
JSON is a lightweight data-interchange format.
True
17. Which one of the following options represent a JSON array?
{“alphabets”:[“a”,”x”,”z”]}
18. What is the purpose of Schema?
To verify and validate XML elements
19. Which of the following is a well formed XML document?
<?xml version=”1.0”>
<employee>
<empname>amina</empname>
<address location=”north”>ramnagar</address>
<phone>2234678</phone>
</employee>
20. JSON object value is accessed by using ________.
dot(.) notation
21. State True or False.
JSON is data oriented and does not provide display capabilities.
True
22. Which one of the following indicators define that either one of the child element must occur within the
element?
Choice
UNIX
Introduction to Unix
Predict the output of this command, who | wc -|
In the following example, the option “-i” is used for the case insensitive search
True
What option is used in cut command to display the second character from each line of a file employeedetails.txt?
-c
grep
$ls -l | awk ‘{print $2}’ is used to return the second item($2) from each line of the output from a ls -l listing.
True
The current line needs to be printed five times in the same file. Identify the command that will execute this task?
yy
In cursor movement command, the w option is used to move the cursor to the beginning of the next word.
True
In Vi editor, a wrong file has been opened for editing. What command should be used to close the file without saving
it?
False
[address range]/d
Sed [options][‘command’][filename]
Create a new file “neq.txt”, which is a concatenation of “file1.txt” and “file2.txt”. Which command would do the
given task?
Which file should be updated so that the changes made will get reflected in all the sessions?
.bash_profile
Which command is used to remove a variable from the list of variables to redefine it?
Unset
Consider the given scenario where the output of the command "$cat file1 file2" is
Displays the content of file1
cat: file2: No such file or directory. Now if we execute the command "cat file1 file2 1>2 2>&1", what would be the
output?
No output is displayed
Consider the given snippet and fill in the blanks with the correct option.
set 10 20 30
echo ____
$#
syntax error
Consider the command, cmd 2>&1 >out and identify its output.
1. Which will inform the kernel about the c program compilation command which is executed in the
prompt?
System class
2. The ______ part of the operating system will interact directly with the computer hardware.
Kernel
3. What is the option to display the calendar using Sunday as the first day of the week.
-s
4. In df command, -H is used to print the disk space size in human readable format.
False
5. Syntax of a Unix command is:
Command [+/-options] [arguments]
6. Which command should be used to know more about the command “whoami”?
man whoami
7. What will be the output of the given code snippet?
~]$ dc
4
5
+
3
P
3
8. Fill the specific date format in the given echo statement, to print the date in dd/mm/yyyy format.
echo `date +[%d]/[%m]/[%Y]`
9. Predict the output for the following command, if the current date is 21-04-2000.
date '+%B %H'
April 21
10. What is the option used in ls command to list all entries in the current directory including hidden files?
-a
11. Single user mode shell has _____ prompt.
# Root user
12. What is the default maximum number of processes that can exist in Unix?
32768
13. Write the command to display the current date in the form dd/mm/yyyy.
date +%d/%m/%Y
File System
14. What command is used to check the current users?
who
15. Choose the umask value which doesn’t allow execute permission for directories by default.
111
16. In which structure on the disk are file attribute information stored?
Inode
17. rm command will remove a file in Unix. Then the file ____________________.
cannot be recovered by a user
18. ________________ is the command to set the execute permissions to all the files and subdirectories
within the directory /home/client1/temp.
chmod –R +x /home/client1/temp
19. Which command will allow the user to search contents of a file for a particular pattern?
grep
20. Code Fillup:
___________ command is used to remove a directory?
rmdir
21. Code Fillup:
______________ is a form of interprocess communication.
redistribution
22. Which symbol is used in pipe command to group two commands?
|
23. Match the Following:
read and write → rw-
read, write and execute → rwx
read and execute → r-x
write and execute → -wx
24. Which command will take backup of "Employee.dat" file to "Employee.log" file?
cp Employee.dat Employee.log
25. A pipe redirects the output of one command as an input to another command.
True
26. Choose the correct symbol which represents the user home directory.
~
27. By default, the reference count for any regular file is 1?
True
28. By default, the cp command will now copy the meta data of the file, but the mv command preserves
the metadata.
True
29. Which directory in the file structure holds the printer details?
/dev
30. Create a hard link “hlink.txt” and a soft link “slink.txt” for “myfile.txt”. Now delete the source file
“myfile.txt”. What will happen to the link files?
Able to access the file ”hlink.txt” but not “slink.txt”
31. If a link is created using command “ln myfile linkfile”, what will be the reference count for the files?
2
32. If two files in the same partition point to the same inode structure, they are called _______.
Hard links
33. What would happen if we try to remove a read only file, rm filename?
file will be deleted with confirmation - interactively
34. What is the bare minimum permission required to get into a directory?
execute
35. If umask value is set to 0002, then what will be the default permissions set for the files?
664
36. Find the equivalent octal notation for the given permission:
Symbolic Notation : r - x r - - r - -
Octal Notation :
544
37. cp command is like [copy‑paste] and mv command is like [cut‑paste] .
The Octal notation for the given permission "-rwxr-xr–x" is represented as ________ .
755
___________command is used to display only the directory attributes and not its contents.
ls -l -d
__________ stamp is not stamped for a file in a traditional Unix file system.
Creation Time
Yes
second.dat
-d, -f
The last change time of the file is updated, if a user does a chmod operation on a file.
'True'
Code FillUp
To refer a field or column in the current line, ___________ symbol is used in awk command.
$
In tee command, if the standard input was successfully copied to all output files, it returns ______.
Consider the directory structure "PARENT/CHILD/GRANDCHILD". Which option in rmdir command will help us to
remove all the directories "PARENT/CHILD/GRANDCHILD"?
–p
list all lines which match with the given pattern with line numbers
What is the option in filter command grep, which removes any entries from the list by excluding any lines that
start with a leading "d"?
grep -v "^d"
cd . → current Directory,
Filters
A pipe redirects the output of one command as an input to another command.
True
Who
redistribution
Which command will allow the user to search contents of a file for a particular pattern?
Grep
Using cat command, content of a file can be modified, but other commands won't effect the original file.
Cat
In Cut command, ______ option is used to identify the column, when the file has fixed length records.
-c
Match the following:
Yes
tee command, if the standard input was successfully copied to all output files, it returns ______.
-d, -f
list all lines which match with the given pattern with line numbers
Code FillUp
To refer a field or column in the current line, ___________ symbol is used in awk command.
$
What is the option in filter command grep, which removes any entries from the list by excluding any lines that
start with a leading "d"?
grep -v "^d"
Vi Editor
Code Fill up:
___________ command is used to close the vi editor.
:wq or :q
/ or ?
:set nu
Arrange the statement.
• $ sed
• 's/
• UK/
• United Kingdom/
• g'
• Country.txt
• > UK.txt
yy → yank,
Which command is used to replace word ‘cat’ (already present in the file) with ‘mouse’ at all places in a file
‘old.txt’ and save the result in a new file ‘new.txt’?
The substitution command (:s/) helps to quickly replace words or groups of words within your files.
True
Which option will provide the current line number, along with the total number of lines in the file at the bottom of
the screen?
^g
Which cursor movement command is used to move the cursor to the last line in file?
$<return>
[address range]/d
Bourne Shell
Which variable is used to display number of arguments specified in command line?
$#
How can you feed standard output of one command to standard input of another in a single shell session?
test
State True/False
Shell is a wrapper for all the commands and utilities.
True
Which of the following commands allows definition and assignment of environment variables under bash?
env
$$
Code Fillup
__________is NOT a valid variable in bash.
var1-var2
• $ name='Williams'
• $ age=21
• echo "Student name is
• $name
• and age is
• $age"
~]$ val1=10
~]$ val2=9
~]$ test $val1 -gt $val2; echo $?
~]$ [0]
For every successful login, which script will be executed?
/etc/profile
Choose the correct option which matches with the given extended regular expression ab?c*
Predict the output of the following command: $ echo "The process id is $$ $$"
When the return value of any function is not specified within the function, what will it return?
Fillup
_________ command prints the lines between 5 and 10 (inclusive of line number 5 and 10).
cat filename | head | tail -6
What would be the current working directory at the end of the following command sequence?
$ pwd
/home/user/project
$ cd source
$ cd code
$ cd .
$ pwd
/home/user/project/source/code
Algorithm Analysis and Design Concepts
Data Structure and Algorithms
Rearrange the below algorithm for finding the Maximum of Three Numbers.
Input: Three numbers a, b, and c
Output: x, the largest Number
• procedure max(a, b, c)
• x := a
• if b>x then
• x := b
• if c>x then
• x := c
• return(x)
• end max
Linear arrays
0 40
The post fix form of the expression (A+ B)*(C*D- E)*F / G is?
Let the following queue can accommodate maximum six elements with the following data:
front = 2; rear = 4;
queue = __ , __ , L, M, N, __ ;
What will happen after an enqueue operation takes place?
front = 2 rear = 5
queue = __ __ , L, M, N, O
Which of the following is a mathematical-model with a collection of operations defined on that model and their
implementations are hidden?
The process of accessing data stored in a serial access memory is similar to manipulating data on a particular
data structure. Which is that data structure?
Stack
Which of the following data structure is better for storing the sorted data on which often insert and deletion
operations are performed?
Linked list
Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the
maximum number of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes:
(()(())(()))
Analysis of Algorithms
What is the purpose of the following code snippets?
• procedure factorial(n)
• if n = 0 then
• return(1)
• return(n * f actorial(n - 1))
• end factorial
Select the code snippet which performs unordered linear search iteratively?
The correct answer is: public int UnorderedLinearSearch(int[] arr, int size, int data)
{
int index=0;
for(int i = 0; i < size; i++)
{
if(arr[i] == data)
{
index = i;
break;
}
}
return index;
}
Jane has created a special type of linked list. That linked list contains no NULL values in its links. If so, what
type of linked list is Jane has created?
If the given array is {6,2, 5, 1, 9 }, the 3rd number from the left while doing bubble sort in the 2nd iteration
5
is Answer
• procedure bubbleSort(A,n)
• for i = 0 to n-1
• for j = 0 to n-i-1
• if A[j] >A[ j+1 ]
• swap a[j] <-> A[j+1]
• end bubbleSort
You have to sort a list 'L' which consists of some sorted elements and few “random” elements. Which of the
following sorting methods would be especially suitable for such a task?
Insertion sort
What is the time complexity for executing merge sort on an array of size n which is already sorted is
O(n log n)
Time complexities of three algorithms are given. Which should execute the slowest for large values of N?
O(n^2)
A linear collection of data elements where the linear node is given by means of a reference is called
Linked list
Choose the correct data structure whose size is fixed and insertion and deletions are bit difficult because we have to
shift the elements upward or downward to avoid the wastage of memory.
Array
________ is a header list where the last node points back to the header node.
Circular header list
which of the following is a logical description of how we view the data and the operations that are allowed without
regard to how they will be implemented?
Arrays
Queue
Choose the correct real-time application which uses Queue for its implementation?
Process Scheduling
Which of the following form of access is used to add and remove nodes from a queue?
FIFO, First In First Out
Which of the following is the correct list where we can apply Binary search algorithm.
Sorted Array
Team leader wanted Raj to develop an efficient algorithm for an application. To check the efficiency of the algorithm
which Raj developed, what are the two main factors he needs to consider?
1. Completeness Is the strategy guaranteed to find the solution when there in one
2. Accuracy producing the correct solution
choose the correct algorithm which is efficient for smaller data sets but not for larger sets
Insertion sort
Pivot element
The number of interchanges required to sort 6,2,7,3,5 in ascending order using Bubble sort is ________
How many number of comparisons are required in insertion sort to sort a file if the file is sorted in reverse order?
N^2
Introduction To Java
JRE consists of ____________ and Java API.
JVM
javac
__________ converts the byte code into machine language and executes it.
JVM
Byte code
Platform independent
J2SE
J2EE
J2ME
float
int
A12b#
_ab123
?: Conditional Operator
If there are two operators of equal priority in an expression, it gets evaluated based on
Associativity
Conditional Operator
num1<<<2
In java boolean true value is a non zero value and false value is zero.
False
Select the correct order of precedence in the following (Highest to lowest) O ll && ?:
&& || ?:
A _________ statement will skip executing a loop further and exit from that loop.
break
if
int num1-10;
if(num1)
System.out.println("Hello");
else
System.out.println("Hai");
What is the output of the following code?
Compilation Fails
Which of the following statements will get executed at least once even if the condition statement is true or false?
do…while
Identify the jump statements that can skip processing remainder of code in its body for that particular iteration.
continue
switch
Given a class with the name Trainee. Which of the following instantiated an object for this class?
A class defines the attributes of objects and methods used to control an object's behaviour.
Class is a template for a collection of objects that share a common set of attributes and behaviour. Object is the
instance of class
The methods of a class with the ________ access specifier cannot be accessed in another class of the same package.
private
<objectName>.<memberName>
In a class, an attribute needs to be accessed from any class in that application. What should be the access specifier
for that attribute?
Public
Access specifier
Mutator
Consider a class Student. It has a method - public float calculateTotalFees(). Which of the following
method signatures is/are valid for method overloading?
public int calculateTotalFees(float busFees,float messfees)
public float calculate TotalFees{float busFees)
Which of the following keywords acts as a reference variable to the current object?
this
Assume a class person identify the correct signature for the constructor.
public Person()
A wrapped data can be unwrapped using ____________ method where xxx is the corresponding primitive.
XXXValue()
For every primitive data type other than character, there is a corresponding wrapper class.
False
java.lang
White space
float f=9.5f;
system.out.println(d);
There are many in built methods in java, which can work only on objects and not on Primitives where wrapper
class can be used.
java.lang
Packages
Compiler searches for the .class files in few directories. These directories are known to the compiler based on
__________.
Class path
Default
Assume there is a class Employee in package pack1 and this class is dependent on Project class which is in package
pack2. Which statement should be included in Employee class?
import pack2.Project;
package model
Assume you have compiled the code correctly. How will you execute the code?
Java model.Employee
Identify the incorrect statement(s) about packages.
To apply binarySearch method to an array, it needs to be a sorted array. If not sorted, then it will result in
Unpredictable output
Assume an array price of size 20. which of the following can be used to access the 5th position element?
price[4]
False
To which of the following can the sort method in Arrays class be applied?
Both options
Array of objects
which of the following can be used if the number of arguments passed to a method are of same data type, but the
number of arguments is unknown?
Varags
length
Declare an array as int numlist =new int 10. which of the following statements will be executed without any
errors/exception?
numlist[0]=10;
numlist[1]=10;
char c = name.charAt(7);
system.out.println(c);
StringIndexOutOfBoundsException
name.concat("Sam");
System.out.println(name);
Welcome
StringBuffer
String pool
The string method in java which is used to match with a pattern is __________.
matches
\W
[0-9]
Pattern
Matcher
Consider this relationship - Iphone is a smart phone. Which of the following statements is/are correct for this
relationship?
If a sub class has a method with the same name, parameter list and return type as declared in the parent class with a
different implementation, then it will lead to
Method overriding
What should be the relationship between two classes, so that inheritance relationship exists between them.
Is A
Multiple inheritance
A child class will inherit the properties and methods of the parent class and it cannot possess any special properties
of its own.
False
_____________ is the process in which one object can acquire the properties and behaviour of the parent object.
Inheritance
members declared as protected in super class will be inherited only by the sub classes within the same package
final
if a method in a super class should not be overridden by the subclass then it should be declared as _______.
Final
_________ keyword is a reference variable that refers to the immediate parent of a class.
Super
State true or false Final keyword can be used with variable and method, but not with a class.
False
casting a reference of parent class to one of its child class is called __________.
Downcasting
Upcasting
class Parent
f.printMessage();
Compilation error
Static binding is achieved through Method Overloading and Dynamic binding is achieved through Method overriding.
The child class of abstract class can be either abstract or concrete class.
True
Zero or more
When a class inherits an abstract class and it does not implement all the abstract methods in that abstract class, then
that class should be ____________.
An abstract class
Statement 1: An abstract class cannot be instantiated Statement 2: An abstract class cannot have a constructor
Which of the following is true about these statements?
A class can Extend only one class and implement one or more interfaces
An interface
b.sendFile();
Here sendFile() is an abstract method in Bluetooth implemented by Samsung. What does the above code depict?
State true or false. Default methods in an interface should have method body.
True
Public
True
interface MyLambda
void display();
class Test
aBlockOfCode.display();
Hello world
Which of the following are true regarding Function Interfaces?
Predicate
Consumer
Unordered
ListIterator
java.util
HashMap
TreeMap
map.put("John","India");
map.put("Pinky","California");
map.put("Tina","Germany");
map.put("Pinky","Russia");
Set mapset=map.entrySet();
System.out.println(mapset);
Which of the below method is used to iterate over each element of the stream.
forEach
Predicate
Which of the below option best explain the purpose of limit method of Stream
Stream
To handle the exception, enclose the code that might throw an exception within a _______ block
try
Runtime
RuntimeException
ArrayIndexOutOfBoundsException
Finally
SQLException
FileNotFoundException
A try block has multiple catch black, then those exception handlers can be in any order
To propogate Checked exception, the method should explicitly throw the exception using the throws keyword
To use a class in try with resources, that class should have implemented ________ interface.
AutoCloseable
Throw
When a method overrides the method in the parent class, which of the following are valid?
It can throw sub classes of the exceptions thrown by the overridden method
System.out.println(date); }
False
Java is _____________________________.
Platform independent
False
French curly braces { } is a must if the for loop executes more than one statement. State true or false.
True
[for]
loops will execute the body of loop even when condition controlling the loop is initially false.
do-while
default:
System.out.println("Hello");
}
byte
What will be the output of the program?
for(int i = 0; i < 3; i++)
{
switch(i)
{
case 0: break;
case 1: System.out.print("one ");
case 2: System.out.print("two ");
case 3: System.out.print("three ");
}
}
System.out.println("done");
One can not specify multiple case labels with commas, as in line 4. Hence compilation error.
Compilation fails.
The break statement causes an exit ___________
In a for loop, if the number of statements are greater than one, which of the following needs to be inserted at the
beginning and the end of the loop?
be public static
API,
JVM
The ________________ statement causes the program execution to stop and JVM to shut down.
System.exit( )
False
class Sample{
private double num = 100;
private int square(int a){
return a*a;
}
}
public class Test{
public static void main(String args[]){
Sample obj = new Sample();
System.out.println(obj.num);
System.out.println(obj.square(10));
}
}
Compile time error
Choose the appropriate access specifier for the attribute value so that it can be accessed from anywhere.
class Test
{
public
int value;
}
Public
Choose the appropriate return type for the getters and setters provided below.
class Test
{
private int value;
void
public setValue(int value){//some code}
int
public getValue(){//some code}
}
Void
Int
Analyze the below program, and fill the correct code so that it produces the below output:
0
0.0
101
class Test
{
public static void main(String a[])
{
Book bobj=new Book();
}
}
[System.out.println(bobj.getBookId());]
[System.out.println(bobj.getBookPrice());]
[bobj.setBookId(101);]
[System.out.println(bobj.getBookId());]
Consider the below code snippet and determine the output.
class Student
{ private int studentId;
private float average;
}
class Test
{
public static void main(String a[])
{
Student s=new Student();
s.studentId=123;
System.out.println(s.studentId);
}
}
Private variables can be accessed only within the class. They cannot be accessed outside the class.
Compile time error
The below code snippet shows an error
System.out.println("BookId:"+bobj.getId());
return bookId;
this.bookId = bookId;
return bookPrice;
this.bookPrice = bookPrice;
}
public class Test {
bobj.setBookId(123);
bobj.setBookPrice(500);
System.out.println("BookId:"+bobj.getId());
System.out.println("BookPrice:"+bobj.getBookPrice());
Analyze the above code and select the correct reason for the error.
When we specify the methodname or variablename or classname wrongly,then we will get an error “cannot find
symbol”. The compiler tries to fetch the methodname "getId" from the book class, where it is not defined.
getId method is not present in the book class
Arrange the code in the correct sequence, so that the program compiles successfully.
Drag and Drop the code so that the constructor for Student class is overloaded correctly.
[ ]
[ ]
[ ]
}
this.studentId = studentId; this.name = name;
this(studentId,name);
this.grade = grade;]
Constructor 2
Match the code with the type of constructor available in the class.
Parameterized Constructor
No-argument Constructor
Default constructor
}
}
Drag and drop the options correctly so that the output will be
Count is 1
Count is 3
System.out.println("Count is "+Product.count);
System.out.println("Count is "+p3.count);
}
}
Non static members cannot be accessed from static methods. If we want to access non static members from a
static method it is possible by creating an object. Hence, only "noOfSeats" can be accessed, not "flightId".
non static method → Can access both static and non static members
Assume class Calculator in package p1 and CalculatorService class in package p2 as shown below.
package p1;
public class Calculator {
__________ static void calculate(){
//some code here
}
}
package p2;
import p1.Calculator;
public class CalculatorService {
public void display(){
Calculator.calculate();
}
}
What can be the valid access specifier for the calculate method in Calculator class so that it can be accessed
from CalculatorService class?
If a method defined within a class in one package has to be invoked from outside, then that method has to be
declared public.
public
Given the class Book in packages p1 and class Main in package p2. In main to create an object of Book, which
of the following are valid.
Since the Book class is present within p1 package, it has to be accessed as "p1.Book", everytime, from package
p2.
p1.Book bookObj=new p1.Book();
Given the class Book and Library in two different packages :
1. package model;
2. public class Book {
3. private static void countBook( ) { }
4. }
1. package util;
2. public class Library {
3. public static void main(String[] args) {
4. // insert code here
5. }
6. }
What is required at line 4 in class Library to use the countBook method of Book class?
• package test;
• import java.util.Scanner;
• public class Main
• {
//Some code here
}
1. package p2;
2. public class TestMain {
3. public static void main(String[] args) {
4. String [] names = new String[10];
5. // insert code here
6. }
7. }
Identify the statement to be written in line 5 in class TestMain to call the display method of class Test.
p1.Test.display(names);
What is the outcome of the code?
void display(double d)
{
System.out.println("DOUBLE");
}
}
public class Sample
{
public static void main(String[] args)
{
new X().display(100);
}
}
INT
Integer x1 = new Integer(120);
int x2 = 120;
System.out.println( x1 == x2 );
Hands On - Strings
Determine the output:
public class Test
{
public static void main(String[] args)
{
int[] x = {1, 2, 3, 4};
int[] y = x;
x = new int[2];
for(int i = 0; i < x.length; i++)
System.out.print(y[i] + " ");
}
}
Array x is initialized with 4 values and this means reference "x" contains the starting address of the array. This
address is copied to the array reference "y". This mean the 4 values can now be accessed with "y" as well. Then
the reference x is assigned with a new array's starting address whose length is 2. Hence the iteration outputs 1 2
12
class Output
{
public static void main(String args[])
{
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}
Array a1 is created so as to contain 10 integer elements. Hence, the length is 10.
Array a2 is initialized with 5 values. . Hence, the length is 5.
10 5
Determine the output:
public class A
{
public static void main(String argv[])
{
int ary[]=new int[]{1,2,3};
System.out.println(ary[1]);
}
}
The array ary is initialized with 3 elements and the element at the first index is 2.
2
Determine the output
public class Trial
{
public static void main(String[] args)
{
int arr[4]={};
System.out.print(arr[0]);
}
}
int arr[4] is syntactically wrong
Compile time error
Determine the output: (MCQ)
public class Test
{
public static void main(String[] args)
{
int[] x = new int[3];
System.out.println("x[0] is " + x[0]);
}
}
The "new" keyword allows memory for storing integer elements in an array to be created in the "heap" and the
memory is initialized with "default of integer" which is 0.
The program runs fine and displays x[0] is 0.
Determine the output
class array_output
{
public static void main(String args[])
{
char array_variable [] = new char[10];
for (int i = 0; i < 10; ++i)
{
array_variable[i] = 'i';
System.out.print(array_variable[i] + "");
}
}
}
array_variable is a character array that can hold 10 characters. The for loop gets iterated for 10 times. During
each iteration, the array index is assigned with the character "i" and printed alongside. Hence the output "iiiiiiiiii".
iiiiiiiiii
Determine the output:
class Evaluate
{
public static void main(String args[])
{
int arr[] = new int[] {0 , 1, 2, 3, 4, 5, 6, 7, 8, 9};
int n = 6;
n = arr[arr[n] / 2];
System.out.println(arr[n] / 2);
}
}
arr is an integer array that is initialized with 10 values.
When n is initialized with value 6, n = arr[arr[n] / 2] evaluates to n = 3. Now, printing arr[n] / 2 will output 1.
1
What will be the content of array variable table after executing the following code?
public class Trial
{
public static void main(String[] args)
{
int []table[]=new int[5][5];
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
if(j == i)
{
table[i][j] = 1;
System.out.print(table[i][j]);
}
else
{
table[i][j] = 0;
System.out.print(table[i][j]);
}
}
System.out.println("\n");
}
}
}
"table" is a 2 dimensional array with 5 rows and 5 columns. It is iterated from 0 through 3 and during each
iteration j==i (iteration variables) is checked. When j==i evaluates to true, the index is assigned the value "1" and
printed. Else, assigned "0'" and printed.
100
010
001
Given a one dimensional array arr, what is the correct way of getting the number of elements in arr
arr.length
is
arr.length
Column size is mandatory to create an array in java. State true or false
False
is used to allocate memory to array variable in Java
new
is used to find string length
length()
Fill in appropriately.
String st1 = new String("JAVA");
String st2 = new String("JAVA");
String st3="JAVA"
3 2 1
objects, in heap memory and in string pool
The "new" keyword allows memory for storing String to be allocated in the "heap" . Otherwise, memory is
allocated in string pool.
[3] objects, [2] in heap memory and [1] in string pool
What is special about string objects as compared to objects of other derived types?
You can concatenate two string objects using ‘+’,
You can create string objects without or without using new operator,
Java provides string constant pool to store the string objects
Given:
1. public class MyLogger {
2. private StringBuilder logger = new StringBuuilder();
3. public void log(String message, String user) {
4. logger.append(message);
5. logger.append(user);
6. }
7. }
The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system.
How must this code be changed to be thread-safe?
StringBuffer is synchronized and therefore thread-safe. StringBuilder is compatible with StringBuffer API but
with no guarantee of synchronization. Because it’s not a thread-safe implementation, it is faster and it is
recommended to be used only in places where there’s no need for thread safety.
Replace StringBuilder with StringBuffer
is the string contained in s after following lines of code?
StringBuffer s new StringBuffer(“Hello”);
s.deleteCharAt(0);
ello
String s1 = null;
is the valid declaration of a String.
String s1 = null;
Predict the output
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}
A character array is initialized with 'a', 'b' and 'c' and the array reference is chars. Printing this reference will
output abc.
A "new" string object is initialized with this reference and this object is referred by "s". Printing this reference will
output abc.
abc
Predict the output
class String_demo
{
public static void main(String args[])
{
int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
System.out.println(s);
}
}
An integer array is initialized with values 65, 66, 67 and 68. Its reference is "ascii". A new string object is
initialized with this reference such that the elements from index 1 through 3 alone gets copied as "characters".
This object is referred by "s". Printing this object will output BCD which are the char-equivalents of 66, 67 and
68.
BCD
+ operator can be used to concatenate two or more String objects in java. State true or false.
True
What will s2 contain after following lines of code?
String s1 = “one”;
String s2 = s1.concat(“two”);
The string "two" referred by s2 is "concatenated to" the string "one" referred by s1.
onetwo
Select the correct choice so that the below statement returns true, if the input provided contains any alphabet
other than xyz.
[a-z&&[^xyz]]
Pattern.matches(" ", "d")
Select the correct choice so that the below statement returns true, if the input provided contains any alphabet
other than xyz.
[a-z&&[^xyz]]
Which of the following matches X occurs n or more times?
X{n,}
Assume that the ID of an employee should start with "CBE" or "BLR" or "HYD" followed by hyphen (-) followed by
4 digits.
Choose the apt regular expression that matches this text.
(CBE|HYD|BLR)[-][0-9]{4}
String Objects are mutable. State true or false.
False
What is the output of this program?
class Output {
public static void main(String args[]) {
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}
10 5
String name="teknoturf";
String cname="teknoturf";
String compname=new String("teknoturf");
1.if(name==cname)
2.if(name.equals(cname))
3.if(name==compname)
4.if(name.equals(compname))
Identify the output.
Line 1,2,4 will return true.
State True or False.
Advanced for loop is better as it is less error prone as we don't need to deal with index.
True
List the correct ways of declaring an Array.
int [ ]studentId;
int studentId[ ];
String [ ] name [ ];
StringBuffer is used to create ______________.
a mutable String
Consider the below statements.
Statement 1 : Matcher class interprets the pattern in a String
Statement 2 : Matcher class matches the regular expression against the text provided
Which of the following is true?
Both Statement 1 and 2 are correct
class TestArray {
public static void main(String args[]) {
int arr_sample[] = new int[2];
System.out.println(arr_sample[0]);
}
}
What will be the result of compiling and executing the above code?
The program compiles and prints 0 when executed.
In which of the following packages can you find String class?
Lang
The first name of a person should contain only alphabets and space.
Which of the following regular expression will match the requirement?
[a-zA-Z ]+
Predict the output of the below code :
import java.util.regex.*;
public class TestRegEx{
public static void main(String args[]) {
Pattern p = Pattern.compile(".ech");
Matcher m = p.matcher("tech");
boolean b = m.matches();
System.out.println(b);
}
}
True
Given a one-dimensional array arr, what is the correct way of getting the number of elements in arr?
arr.length
StringBuilder is less efficient and slower than StringBuffer. State true or false.
False
Which of the following text when matched with the regular expression “[a-zA-Z&&[^aeiou]]+” will return true?
My,
Cry
class ArrayTest {
public static void main(String args[]) {
int[] primes = new int[10];
primes[0] = "a";
System.out.println(primes[0]);
}
}
What will be the result of compiling and executing the above code?
compile time error
Class FourWheeler
Class Car
Class Audi
10. class FourWheeler {
11. blank void display() { }
12. }
13. class Car extends FourWheeler {
14. blank void display() { }
15. }
Which method at line 14, will correctly complete class Car?
Private
protected
Given:
class FourWheeler
{
public FourWheeler ()
{
System.out.print(1);
}
}
class Car extends FourWheeler
{
public Car()
{
System.out.print(2);
}
}
class Audi extends Car
{
public Audi()
{
System.out.print(3);
}
}
public class Driver
{
public static void main( String[] argv )
{
new Audi();
}
}
What is the result when this code is executed?
The first statement that always gets executed from within any constructor is super() which means the
invocation of super class no-parameterized constructor.
FourWheeler is the parent of Car and Car is the parent of Audi. The no-parameterized constructor call of Audi
happens from the driver class. Followed by the no-parameterized constructor call of Car. Followed by the no-
parameterized constructor call of FourWheeler. Hence, the output "123".
123
The class Employee is declared in a package mainpack and the Derived classes PermanentEmployee and
TemporaryEmployee are declared in another package subordpack. The basicPay attribute should be accessed
only by means of a derived class object.
How to ensure that the basicPay attribute is not accessed directly by the other classes in the subordpack?
Employee.java
mainpack
package ;
public class Employee{
protected
int basicPay;
}
/*PermanentEmployee.java*/
subordpack
package ;
public class PermanentEmployee extends Employee{
.....
}
//TemporaryEmployee.java
subordpack
package ;
public class TemporaryEmployee extends Employee{
.....
}
For a child class that is residing in a package to access a variable of its parent that is residing in a different
package, the variable in the parent has to be declared "protected" so that it will be visible to all its children
across packages. The "protected" basicPay attribute is not accessed directly by the other classes in the
subordpack, in our case.
Mainpack
Protected
Subordpack
Subordpack
class FourWheeler{
protected FourWheeler getObject()
{
//logic with return statement
}
}
class Car extends FourWheeler
{
blank
}
class Driver
{
public static void main(String args[])
{
FourWheeler object = new Car();
object.getObject();
}
}
Java 5.0 onwards it is possible to have different return type for a overriding method in child class, but child’s
return type should be sub-type of parent’s return type. The visibility of a method can only be increased as we
traverse down the hierarchy.
protected Car getObject() {}
Say that there are three classes: Computer, AppleComputer, and IBMComputer. What are the likely relationships
between these classes
Computer is the super class, AppleComputer and IBMComputer are subclasses of computer
can
Constructor of the superclass be invoked by from its subclass.
cannot
A default member of a super class in one package be accessed in its own subclass which is in a
different package.
can
A protected member of a super class in one package be accessed by its own subclass which is
in a different package.
Can
Cannot
Can
State True or False
Child class objects can be instantiated when the parent class constructor is protected
True
blank is the most restrictive access modifier that will allow members of one class to have access to members
of another class in the same package.
Default Access
private
Given a method in a public class, access modifier must be used to restrict access to that
method to only the other members of the same class.
Private
Interpret which of the following statements are correct with respect to inheritance relationship in java?
object of subclass referenced by super class type can invoke super class methods,
object of subclass referenced by super class type can invoke overridden sub class methods,
object of subclass referenced by super class type can access super class variables
PREDICT THE OUTPUT
Observe the following code
class FourWheeler
{
public void display()
{
System.out.println("FourWheelers displayed");
}
public void get()
{
System.out.println("Get FourWheelers");
display();
}
}
class Car extends FourWheeler
{
public void display()
{
System.out.println("Cars displayed");
super.display();
}
}
What is the output of the above code ?
The main method has child object referred by parent reference. In this case, on invoking any method, only when
a method is unavailable in the child, it is searched for in the parent.
The functions get executed in the following order.
get() of FourWheelers class
display() of Car class
diaplay() of FourWheelers class
Get FourWheelers
Cars displayed
FourWheelers displayed
Predict the output
Class Icecream{
public void displayName(String...s){
System.out.println(s+” “ +“Icecream");
}
public void describe(String s) {
System.out.println(s+” “ +"Icecream: Ice cream is a sweetened frozen food typically eaten as a snack or
dessert. ");
}
}
class Faloodeh extends Icecream {
public void displayName (String s){
System.out.println(s+” “ +"Faloodeh ");
}
test Faloodeh
test Faloodeh
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
What will be the output of the program?
class Tree { }
class Pine extends Tree { }
class Oak extends Tree { }
public class Forest1
{
public static void main (String [] args)
{
Tree tree = new Pine();
if( tree instanceof Pine )
System.out.println ("Pine");
else if( tree instanceof Tree )
System.out.println ("Tree");
else if( tree instanceof Oak )
System.out.println ( "Oak" );
else
System.out.println ("Oops ");
}
}
Since Pine object is held by Tree type reference - tree, the first condition in the if construct evalutes to true and
hence, "Pine".
Pine
Given:
1. class Dog { }
2. class Beagle extends Dog { }
3.
4. class Kennel {
5. public static void main(String [] arfs) {
6. Beagle b1 = new Beagle();
7. Dog dog1 = new Dog();
8. Dog dog2 = b1;
Beagle b3 = (Beagle) dog2;
9.
10. }
11. }
Which, inserted at line 9, will compile?
Beagle b4 = dog2; is wrong because a child type reference can never old the parent object or parent reference.
Beagle b3 = (Beagle) dog2; is right because a downcasted parent reference can be assigned to a
child reference.
Beagle b3 = (Beagle) dog2;
What will be the output of the following program ?
class A
{
public void test()
{
System.out.println("Class A");
}
}
class Trial extends A
{
public void test()
{
System.out.println("Class Trial");
}
public static void main(String args[])
{
Trial object = (Trial)new A();
object.test();
}
Trial object = (Trial)new A(); produces compile time error because a parent object can never be referred by a
child type reference.
Runtime Error
class Calculator
{
Calculator()
{
System.out.println("Basic arithmetic operation ");
}
Calculator (int x)
{
this();
System.out.println(x + " " + "is the only operand supplied");
}
Calculator(int x, int y)
{
this(5);
System.out.println("Two operands supplied are multiplied and the resultant is "+ x * y);
}
public static void main(String args[])
{
new Calculator(8, 10);
}
}
The main method has the two parameterized constructor call. the first statement within this definition is one
parameterized constructor call. And the first statement within this is no parameterized constructor call.
Hence the output : Basic arithmetic operation , 5 is the only operand supplied, Two operands supplied are
multiplied and the resultant is 80.
True
final methods
can't be overridden.
final methods
A public static method in class X can be called by a subclass of X without explicitly referencing the class X.,
A method with the same signature as a private final method in class X can be implemented in a subclass of X.
If you have - final class Test {} how to create a reference for the class “Test” while inheriting it?
}
}
Here is multilevel inheritance. The main method has object created for class Square, referred by Square type
reference.
The abstract methods clacArea() and calcVolume() in parent have their implementation within their children.
Only when an implementation is not found child class, it is searched for in parent class and executed. Hence
111, 222.
111
222
What is the Output of following Java Program?
abstract class Demo
{
public int a;
Demo()
{
a = 10;
}
abstract public void set();
}
class Test extends Demo
{
final public void get()
{
System.out.println("a = " + a);
}
public static void main(String[] args)
{
Test obj = new Test();
obj.get();
}
}
The program produces compile time error because the abstract set method in the parent has not found its
implementation in child class (which has the main method too).
Compile Time Error
can
An abstract class have non abstract methods also.
Can
cannot
Abstract methods be final.
Cannot
Number
Object
Number
The type Vehicle has drive functionality. The classes Car and Bike implements the drive functionality and can be
further subclassed. Fill in the given code with appropriate access specifier so that the subclasses of Car and
Bike do not modify the Drive functionality.
interface Vehicle{
void drive();
}
class Car implements Vehicle{
public final
void drive() {
//drive }
}
public
final
If a class extends two interfaces and they both have a method with same name and signature but different
return type, then a conflict will arise because the compiler will not able to link a method call due to ambiguity.
State true or false.
True
An interface can contain public, static, final fields (i.e., constants) default and static methods with
True
bodies
False
An instance of interface can be created.
True
A class can implement multiple interfaces.
True
Many classes can implement the same interface.
True
False
True
True
Variables within interface are static and final by default. They can not be assigned a value in the classes that
implement this interface.
error, since variable a is assigned a value
public abstract interface Insurance{
public void insuranceDescription(String s);
}
Which is the correct class?
interface ICalculate
{
public int add(int a,int b);
}
extends
interface IScientificCalculator Calculator
{
public int calcSine(double value);
}
Extends
interface ICalculate
{
public int add(int a,int b);
}
implement
class Test ICalculate
{
public int add(int a,int b)
{
//some code
}
}
Implements
//some code
}
Extends
Mobile
Implements
Bluetooth
All methods that are declared in an interface are by default public and abstract.,
Interface can contain any number of default methods which needs to be provided with implementation.
interface Loan
{
double issueLoan(double salary);
double repayLoan(double loanAmt,double amount);
}
class Employee implements Loan
{
double issueLoan(double salary) {
System.out.println("Issue Loan");
return salary * 0.10;
}
double repayLoan(double loanAmt,double amount) {
System.out.println("Repay Loan");
return loanAmt - amount;
}
}
What is the output of the above code when executed as :
Employee e = new Employee();
e.issueLoan(500000);
Compilation error
Observe the below code
interface A {
public void printNumber(int a);
public default void display()
{
System.out.println("Hello");
}
}
class Test{
public static void main(String args[])
{
A a1= (num) -> System.out.println(num);
a1.printNumber(20);
}
}
If a method in an interface is implemented in it, then that method should be either _______ or _________.
static, default
Given:
1. public class Employee {
2. String name;
3. double baseSalary;
4. Employee(String name, double baseSalary) {
5. this.name = name;
6. this.baseSalary = baseSalary;
7. }
8. }
And:
11. public class Salesperson extends Employee {
12. double commission;
13. public Salesperson(String name, double baseSalary,
14. double commission) {
15. // insert code here
16. }
17. }
Which code, inserted at line 17, completes the Salesperson constructor?
super(name, baseSalary);
this.commission = commission;
If a method in a super class is overridden by the sub class, then the overridden method can be invoked using
____________ keyword.
Super
Assume Book is a parent class and Magazine class is the child of Book class.
Match the following:
Book b = new Magazine();
Magazine m = (Magazine) b;
Book b = new Magazine(); → Upcasting,
A default method in an interface can be either private or public or protected. State True or False.
False
( )->System.out.println("Welcome");
class A {
String name="A";
public String getName() {
return name;
}
String greeting() {
return "class A";
}
}
class B extends A {
String name="B";
String greeting() {
return "class B";
}
}
public class Test {
public static void main(String arg[]) {
A a=new A();
A b=new B();
System.out.println(a.greeting()+" has name "+a.getName());
System.out.println(b.greeting()+" has name "+b.getName());
}
}
Place the names "A" and "B" in the following output.
BA
Which of the following represents the correct lambda expression for the Functional method :
int findMin(int a,int b) ?
(int a,int b) -> {
int min = a>b ? a : b;
return min; }
@FunctionalInterface
interface Test
{
int a=10;
public void display();
}
@FunctionalInterface
interface Test
{
public void display();
}
Final
Exception Handling
Observe the statements.
Statement 1 : An abstract class cannot have non abstract methods
Statement 2 : An abstract class should have a minimum of one abstract method in its class.
Abstract class can have attributes and normal methods along with abstract methods.
For a class to be abstract, it can have zero or more abstract methods.
Statement 1 and Statement 2 are false
If the access specifier of the display method in super class is protected, then what could be the valid specifier
for the overriding display method in sub class?
The subclass overridden method cannot have weaker access than super class method. Which means, when
overriding a method, the access level cannot be more restrictive than the overridden methods access level. In
parent class the method is protected, then in child class it can be protected or public.
If the sub class overrides the method in the parent class, the overridden method can be invoked by using either
‘this’ or ‘super’ keyword. State true or false.
False
Error
java.lang.Object
Class
Exception is a
Class
The class Exception and all its subclasses that are not also subclasses of RuntimeException are checked
exceptions,
The class RuntimeException and all its subclasses are unchecked exceptions
Which of the given facts are true with respect to the blocks and order of execution of blocks in "Exceptions"?
One or more catch blocks which are exception handlers are placed immediately after the try block,
The finally block always executes when the try block exits or when an exception occurs,
Catch block has an argument which can accept an argument of any exception type and it is the name of a class
that inherits from the Throwable class
What will happen when catch and finally block both return value?
method will return value returned by finally block
try
{
int i= 10/0;
}
catch(ArithmeticException e)
{
return "catch";
}
finally
{
return "finally";
}
}
}
"method return ->" is followed by the function call. The try block within the function raises an exception. It is
caught and handled. This is followed by the execution of the finally block.
When there's a return statement in both catch and finally block, then return in finally is what is actually returned
to the function. Hence, "method return -> finally."
84. try {
85. ResourceConnection con = resourceFactory.getConnection();
86. Results r = con.query("GET INFO FROM CUSTOMER");
87. info = r.getData();
88. con.close();
89. } catch (ResourceException re) {
90. errorLog.write(re.getMessage());
91. }
92. return info;
Which statement is true if a ResourceException is thrown on line 86?
There's no exception raised within the try block. Hence, the print statement within try, finally and the statement
outside try and finally, all get executed in sequence. Hence, ACD.
ACD
What will be the output of the program?
public class RTExcept
{
public static void throwit ()
{
System.out.print("throwit ");
throw new RuntimeException();
}
public static void main(String [] args)
{
try
{
System.out.print("hello ");
throwit();
}
catch (Exception re )
{
System.out.print("caught ");
}
finally
{
System.out.print("finally ");
}
System.out.println("after ");
}
}
}
}
}
Overridden: Welcome (String, int[])
This code will compile if we add throws ProductNotFoundException in the signature of method
findProductsList().
The ________________ statement automatically closes all resources opened in the try clause.
Try with resources
Throw
When a code needs to be executed whether or not an exception occurs, that code can be written in _____ block.
Finally
java.util.Map
interface provides the capability to store objects using a key-value pair ?
java.util.Map
The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into
hash buckets for swift retrieval.
Given:
11. public class Person {
12. private String name;
13. public Person(String name) {
14. this.name = name;
15. }
16. public int hashCode() {
17. return 420;
18. }
19. }
Which statement is true?
The time to find the value from HashMap with a Person key depends on the size of the map.
Given
1. import java.util.*;
2. public class WrappedString {
3. private String s;
4. public WrappedString(String s) { this.s = s; }
5. public static void main(String[] args) {
6. HashSet<Object> hs = new HashSet<Object>();
7. WrappedString ws1 = new WrappedString("aardvark");
8. WrappedString ws2 = new WrappedString("aardvark");
9. String s1 = new String("aardvark");
10. String s2 = new String("aardvark");
11. hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);
12. System.out.println(hs.size()); } }
What is the result?
3
ListIterator
nextIndex() and previousIndex() are methods of interface
ListIterator
binarySearch
Collection<E>,
Map<K,V>
Observe the below code
List<Integer> markList = Arrays.asList(68,34,21,42,85,72,60);
markList.stream().filter((mark) -> mark > 60).sorted().forEach(System.out::println);
Which intermediate methods of stream API are used in the above code?
filter,
sorted
Compare
parallelStream()
Which interface should a class implement so that it can be sorted based on many fields / criteria?
Comparator
Eclipse IDE
Which of the following options remain true for case constants in a switch construct?
If no case matches but there is a default label, then all statements after the matching default label in the switch
block are executed in sequence,
The code with the switch construct gives a compilation error when there is a duplicate case label,
If any one of the case constants has a match with the expression, then all statements after the matching case
label in the switch block are executed in sequence
__________ generates the byte code for a given file with .java extension.
JDK
J2EE
In a nested for loop, the continue statement in an inner loop can be used to bypass the current iteration of
outerloop .
False
JVM
True
We can move an already existing project in eclipse to another location by compressing it. This we call as
________ the project.
Exporting
A project developed on one machine can be included in the current workspace by ___________ that project.
Importing
RDBMS Concepts
Information is stored in flat files which are maintained by the file system under the _____ control.
Operating system
True
"Software that enables users to define, create and maintain the database and provides controlled access to the
database."
DBMS
In traditional approach, _____ go through the file system in order to access flat files.
Application programs
"A shared collection of logically related data, designed to meet the needs of an organization is called as _________.”
Database
tree
network
Which user interacts with the system by forming their requests in a database query language?
Specialized User
Which user interacts with the system by invoking one of the permanent application programs that have been written
previously?
End users
A data model is a way of explaining the logical layout of the data and the relationship of various parts to each other
and the whole.
True
Relational
False
SQL is an ANSI standard computer language for accessing and manipulating database systems.
True
DDL
char
Table name can have only letters, numbers and underscore.
True
Alter
Rename
Which data type is used to store both integer and float value?
number
True
True
user_constraints
False
Alter
Can we drop a table or a column from a table which has a primary key?
Yes
User cannot override the default constraint name with the user defined constraint name.
False
Data for date, char and varchar types should be always enclosed within single quotes.
True
What command is used to delete the data from the table without deleting the table structure?
delete
delete
update
Deletion is not possible if the row to be deleted is referred in the child table.
Yes
Update
Truncate removes all rows from the table and cannot be reverted back
True
Yes
_______ provides the ability to conditionally update or insert data into a database table.
Merge
Locking
Yes
False
Rollback
Which SQL statement is used to fetch the data from a database table?
SELECT
Which query will return all the rows and columns from the table?
False
||
In SELECT statement, alias name should be in double quotes, if it contains more than ____ word.
one
SQL Statements are _______, but the data stored in the database is _______.
SELECT statement can be used for retrieving only specific values from the table.
False
Which clause is used to extract only those records that fulfil a specific condition?
WHERE
Which keyword in the SELECT clause is used to eliminate duplicate rows?
DISTINCT
ORDER BY
Single-row functions can be nested to any level and nested functions are evaluated from the deepest level to the
least deep level.
TRUE
Which character function returns specified characters from the character value starting at character position m, n
characters long?
substr()
Which number function returns the largest integer value that is equal to or less than a number?
floor()
add_months
Which function compares two expressions and returns null if they are equal or the first expression if they are not
equal?
NULLIF()
Which function returns the first not null expression in the expression list?
COALESCE()
Which conditional expression facilitates conditional inquiries by doing the work of a CASE or IFTHEN- ELSE
statement?
Decode function
Which conditional expression facilitates conditional inquiries by doing the work of an IF-THEN-ELSE statement.
Case expression
We can use the group functions to return summary information for each _____.
group
GROUP BY
False
All columns in the SELECT list must be in the GROUP BY clause apart from the group function.
True
When you join a table without any condition, it will lead to Cartesian product.
True
When two tables are joined using operator in the join condition it is called as _________.
equi join
non equijoin
Which clause is used to combine records from two or more tables, based on a common field between them?
JOINS
All rows in the first table joined to all rows in the second table is called a Cartesian product.
True
“The ______ returns all the rows from the left table, with the matching rows in the right table.”
“The ____ returns all the rows from the right table, with the matching rows in the left table.”
“____________ returns rows only when there is at least one row from both the tables that matches the join
condition.”
equi join
“________ returns all the rows from one of the tables mentioned in the FROM clause even if the condition is not
matched.”
outer join
________ is a type of EQUI JOIN that compares the common columns of both the tables with each other.
NATURAL JOIN
________ joins the table to itself. It is done by creating alias names for the same table.
self join
________ clause specifies which columns to test for equality when two tables are joined.
USING
one
A subquery is a query that is nested inside a SELECT, INSERT, UPDATE, or DELETE statement, or inside another
subquery is done the subquery result the main query will be executed.
TRUE
any
in
<>
The subquery returns a temporary table in the database server’s memory and then it is not only used by the outer
query for further processing.
False
When you insert a select statement into a FROM clause, it becomes a subquery.
True
Correlated subquery
which is used to create privileges to allow users to access and manipulate the database?
DCL
REVOKE
GRANT
simple view
which view does not always allow DML operations through the view?
Complex view
we can insert update or delete the records from the original table using Complex view.
no
You cannot remove a row if the view contains _______, ______ and _______:
Group functions
GROUP BYClause
An inline view is a subquery with an alias that can be used within an SQL statement.
True
“_____ is a virtual table that provide a view a window through which one can see data (stored in a base relation).”
View
Views contain no data of their own but can be operated on as real relations.
True
Sequence
NEXTVAL returns a unique value every time it is referenced, even for different users.
yes
_______ create an index which sorts the data file in the order of the index file.
Clustered Index
_______ is used by the Oracle service to speed up the retrieval of rows by using a pointer.
Index
yes
INSERT
Network,
Relational
Database is a shared collection of logically unrelated data, designed to meet the needs of an organization. State
True or False.
FALSE
Unique,
Check
_______ refers to the range of values that can be stored for an attribute → Domain,
Tom has designed a payroll software for XYZ technology.The software will store the salary details into the
database and later he can retrieve the same for future references. Tom falls under which category of user.
Application Programmer
An emp table contains fields employ name, desig and salary. How do you drop column salary?
alter table emp drop column salary;
We need to ensure that the amount withdrawn should be less then the credit card limit amount, to ensure this
integrity what type constraint will be used?
table level check constraint
How would you add a foreign key constraint on the dept_no column in the EMP table, referring to the id
column in the DEPT table?
Use the ALTER TABLE command with the ADD clause on the EMP table.
Tom , the administrator gets an error when executing the following scripts in the Oracle server. He finds that the
SQL statements placed are not in the correct order.
Help Tom to place the statements in the correct order. The script starts from the creation of course table. The
schema diagram is given below
Tom, the administrator should create the table "CSR_Registration" with the following rules
• Whenever a row in the CSR_Student table is deleted, the row from the CSR_Registration must be deleted
• When deleting the row from the CSR_course table link column of the CSR_registration must be made to
null
• Drag and drop the correct keyword for the below given query.
on delete cascade
Which statement would you use to add a primary key constraint to the patient table using the id_number column,
immediately enabling the constraint?
Which SQL statement needs both insert and update privilege on the target table and select privilege on the
source table?
merge
select
Match appropriately.
Drop Removes the table itself from the database.
Answer 1
Delete Removes all or only the rows specified from the table.
Answer 2
Truncate Removes the entire data from the table, while the structure remains intact.
Answer 3
Drop → Removes the table itself from the database.,
Delete → Removes all or only the rows specified from the table.,
Truncate → Removes the entire data from the table, while the structure remains intact.
It is possible to update more than one column with a single UPDATE statement. State true or false.
True
To have all the rows deleted from the table using delete statement, you must specify the query with WHERE
clause that specifies all the rows. State true or false.
False
ALTER TABLE
To change the structure of the table we use Syntax.
ALTER TABLE
Select Statement
You need to remove all the data from the employee table while leaving the table definition intact.
You want to be able to undo this operation. How would you accomplish this task?
How to retrieve department_id column without any duplication from employee relation?
select distinct department_id from employee;
Select the suitable option for retrieving all the employees who have a manager?
select empname, manager_id from employee where manager_id is NOT NULL;
Select the suitable option for retrieving all the employees whose salary range is between 40000 and 100000?
select name,salary from employee where salary between 40000 and 100000;,
Select the missing keyword, to complete the select query for the given scenario
select the student details whose firstname starts with 'A' or whose city is 'Chennai' and firstname ends with 'n'
OR AND
select * from CSR_STUDENT where firstname like 'A%' city ='Chennai' firstname like
'%n';
OR
AND
Select the suitable option for retrieving all the employees whose last name is "kumar"?
select * from employee where empname like '%kumar';
View the Exhibit and examine the structure of the PROMOTIONS table. You need to generate a report of all
promos from the PROMOTIONS table based on the following conditions:
1. The promo name should not begin with 'T' or 'N'.
2. The promo should cost more than $20000.
3. The promo should have ended after 1st January 2001.
Rearrange the WHERE clause to obtain the required result?
• WHERE promo_name
• (NOT LIKE 'T%' OR
• NOT LIKE 'N%')
• AND promo_cost > 20000 AND promo_end_date >
• '1-JAN-01'
The SELECT statement is used to describe the table and the table data from a database. State true or false.
False
blank should be used if you want to select all the fields available in the table.
Which of the following are the correct syntaxses for displaying the StudentName and Department from Student
table?
FROM employee
Generate a list of all customer last names with their credit limits from the CUSTOMERS table. Customers who do
not have a credit limit should appear last in the list. kindly note that customers who do not have credit card will
have NULL against credit limit.
Which query would achieve the required result?
SELECT cust_last_name,cust_credit_limit
FROM customers
ORDER BY cust_credit_limit;
ABC company wants to give each employee a $100 salary increment. You need to evaluate the
results from the EMP table prior to the actual modification. If you do not want to store the results in the
database, which statement is valid?
You need to give the arithmetic expression that involves the salary increment in the DISPLAY
clause of the SELECT statement.
Select the suitable option for fetching the output of the following query. select substr("Oracle World",1,6) from
dual;
Oracle
To calculate the number of days from 1st Jan 2007 till date:
Dates are stored in the default format of dd-mm-rr.
Which SQL statements would give the required output?
SELECT SYSDATE - TO_DATE('01/JANUARY/2007') FROM DUAL;,
Which statement is true regarding the default behavior of the ORDER BY clause?
In a character sort, the values are case-sensitive
Which query would give the required result? (Choose all that apply.)
SELECT promo_name,promo_begin_date
FROM promotions
WHERE promo_begin_date > '01-JAN-01'
ORDER BY 2 DESC;
To update the CUST_CREDIT_LIMIT column to NULL for all the customers, where
CUST_INCOME_LEVEL has NULL in the CUSTOMERS table. Which SQL statement will
accomplish the task?
UPDATE customers
SET cust_credit_limit = NULL
WHERE cust_income_level IS NULL;
Select the suitable option for displaying the average commission percentage of all employees, where the
commission percentage column of certain employees include NULL value.
All columns in the SELECT list that are not in group functions must be in the GROUP-BY clause. State True or
False.
TRUE
Group functions can be used in the where clause. State True or False.
FALSE
We need to create a report to display the order id, ship date and order total of your ORDER table. If the
order has not been shipped, your report must display 'Not Shipped'. If the total is not available,
your report must display 'Not Available'.
In the ORDER table, the SHIPDATE column has a datatype of DATE. The TOTAL column has a
datatype of INT.
Which statement do you use to create this report?
SELECT ordid, IFNULL(shipdate, 'Not Shipped') SHIPDATE,
IFNULL(total,'Not Available')TOTAL FROM order;
We need to analyze how long your orders take to be shipped from the date that the order is
placed. To do this, you must create a report that displays the customer number, date ordered, date
shipped, and the number of months in whole numbers from the time the order is placed to the time
the order is shipped. Which statement produces the required results?
SELECT custid, orderdate, shipdate,
ROUND(MONTHS_BETWEEN (shipdate, orderdate))
"Time Taken" FROM ORD;
Single row functions can be nested to any level. State true or False.
TRUE
• from
• where
• group by
• having
• select
• order by
Single row function accepts only a single argument. State true or false.
False
You need to generate a report that displays the IDs or all products in the COSTS table whose unit price is at least
25% more than the unit cost. The details should be displayed in the descending order of 25% of the unit cost.
You issue the following query:
• SELECT prod_id
• FROM costs
• WHERE unit_price >= unit_cost*1.25
• ORDER BY unit_cost*0.25 DESC;
Using the CUSTOMERS table, you need to generate a report that shown the average credit limit for customers in
WASHINGTON and NEW YORK. Which SQL statement would produce the required result?
SELECT cust_city,AVG(cust_credit_limit) FROM customers WHERE cust_city IN ('WASHINGTON','NEW YORK')
GROUP BY cust_city;
ORDER BY must be the clause in the SELECT statement. You specify any combination of numeric positions
and column names in the order by clause.
Last
can
The ON clause can be used to join tables on columns that have different names but compatible data types.,
The WHERE clause can be used to apply additional conditions in SELECT statement
containing the ON or the USING clause.
To create a report displaying employee last names, department names, and locations. Which query should you
use to create an equi-join?
It executes successfully.
To display the names of employees who earns more than the average salary of all
employees.
SELECT last_name, first_name
FROMemployee
WHEREsalary > AVG(salary);
Which change should you make to achieve the desired results?
Use a subquery in the WHERE clause to compare the average salary value.
The COMMISSION column shows the monthly commission earned by the employee.
Emp_Id Dept_Id Commission
1 10 500
2 20 1000
3 10
4 10 600
5 30 800
6 30 200
7 10
8 20 300
Which tasks would require sub queries or joins in order to be performed in a single
step?
Listing the employees who earn the same amount of commission as employee 3,
Finding the number of employees who earn a commission that is higher than the average commission of the
company
Which statement would display the highest credit limit available in each income level in each city in the
Customers table?
SELECT cust_city, cust_income_level,MAX(cust_credit_limit)
FROM customers
GROUP BY cust_city, cust_income_level;
The following query is written to retrieve all those product IDs from the SALES table that have more than 55000
sold and have been ordered more than 10 times:
SELECT prod_id FROM sales WHERE quantity_sold > 55000 AND COUNT(*)>10
GROUP BY prod_id HAVING COUNT(*)>10;
Which statement is true regarding this SQL statement?
It produces an error because COUNT (*) should be only in the HAVING clause and not in the
WHERE clause.
Which operator is NOT appropriate in the join condition of a non-equi join SELECT statement?
equal operator
There is more than one employee with the first name Scott.
SELECT c.cust_last_name,p.prod_name,s.quantity_sold
FROM products p JOIN sales s
ON(p.prod_id=s.prod_id)
JOIN customers c
ON(s.cust_id=c.cust_id)
WHERE c.cust_city='Tokyo';
ANY,
ALL
In which two cases would you use the USING clause? (Choose two)
The tables to be joined have columns of the same name and different data types.,
The tables to be joined have columns with the same name and compatible data types.
Which SELECT statement displays all the employees who do not have any subordinates?
SELECT e.ename
FROM emp e
WHERE e.empno NOT IN (SELECT m.mgr
FROM emp m
WHERE m.mgr IS NOT NULL);
last name and first name of all employees with the same salary as employees in department 3 or 5
To display the names of employees who earns more than the average salary of all
employees.
SELECT last_name, first_name
FROMemployee
WHEREsalary > AVG(salary);
Which change should you make to achieve the desired results?
Use a subquery in the WHERE clause to compare the average salary value.
.
You issue the following SQL statement on the CUSTOMERS table to display the customers who are in the same
country as customers with the last name 'king' and whose credit limit is less than the maximum credit limit in
countries that have customers with the last name 'king'.
. Which
statement is true regarding the outcome of the above query?
Rearrange the statement so as to obtain the names of products whose list price is the second highest in the
table
The NOT operator can be used with IN, ANY, and ALL operators in multiple-row subqueries. State true or false.
True
different
Main query and subquery can/must get data from tables.
Different
Mr. John is the president of a company. Five managers report to him. All other employees report to these
managers.
Examine the code:
SELECT employee.ename FROM emp employee
WHERE employee.empno NOT IN (SELECT manager.mgr
FROM emp manager);
The above statement returns no rows selected. as the result. Why?
The _______ join is based on all columns in the two tables that have the same column name.
Natural
To delete rows from the SALES table, where the PROMO_NAME column in the
PROMOTIONS table has either blowout sale or everyday low price as values.
Which DELETE statements are valid? (Choose all that apply.)
DELETE
FROM sales
WHERE promo_id = (SELECT promo_id
FROM promotions
WHERE promo_name = 'blowout sale')
OR promo_id = (SELECT promo_id
FROM promotions
WHERE promo_name = 'everyday low price');,
DELETE
FROM sales
WHERE promo_id IN (SELECT promo_id
FROM promotions
WHERE promo_name = 'blowout sale')
OR promo_name = 'everyday low price';,
DELETE
FROM sales
WHERE promo_id IN (SELECT promo_id
FROM promotions
WHERE promo_name IN ('blowout sale','everyday low price'));
_____ is used to retrieve records that do not meet the join condition
Outer Join
Which SQL statement would you use to remove a view called EMP_DEPT_VU from your schema?
DROP VIEW emp_dept_vu;
You need to create the patient_id_seq sequence to be used with the patient table's primary key column. The
sequence should begin at 1000, have a maximum value of 999999999, never reuse any numbers, and increment
by 1.
Which statement would you use to complete this task?
The owner has all the privileges on the object. State true or False.
True
An owner can give specific privileges on the owner's objects to others. State...
True
Web Technology
In the login page, the user does not enter the password and gets an error
Static page
Web page
The term "internet" is also called as "internet super highway". state true or false.
False
Website
<h1>
<!-- -->
When the user clicks on a sign up image, the login page should be displayed in the same window. Which of the
following options will do this?
In the webpage, we have an image to be displayed on the left corner of the webpage. Certain browsers might not
support the image, and in that case a message should be displayed as "Image cannot be displayed". Which of the
following will suit the above requirement?
<body>
<form action="success.html">
User Name <input type="text" name="uname"/> <input type="submit" value="Login"/> <input type="reset"
value="reset"/> </form></body>
<!doctype html>
Which attribute allows you to specify your browser to complete the input based on what you may have been
entered in the browser previously?
autocomplete
True
Both
The current HTMLS draft specification does not specify the types of audio formats that browsers should support in
the audio tag.
HTML5 supports-audio> tag which is used to embed sound content in an HTML or XHTML document.
Which of the following form inputs is used to send information to the server?
<input type="submit">
Which of the following input fields allow the user to select multiple values?
datalist
Checkbox
Select the Doctype that should be specified at the top of all HTML5 documents.
<!doctype html>
To display the text as in default font style, which of the following styles should be apply?
font-style:normal;
CSS selectors are used to select element(s) to apply different styles. State true or false.
True
choose the appropriate inline CSS font style to display the given text in cursive.
<h1 style=”font-family:cursive”>Welcome</h1>
which of the following code snippet will display a square box in the web page?
<html>
<head>
<style type=”text/css”>div
height: 100px;
width: 100px;
background:blue;
</style>
</head>
<body>
<div>square></div>
</body>
</html>
<style type="text/css">
*{ color: yellow;}
p{ color:blue;}
</style>
Which of the following statements are true with respect to the above code?
=*{} is a universal selector and p{} is a type selector.
The entire HTML page contents will be displayed in yellow color, expect the content
present inside <p> tag.
Which of the following property is used as a shorthand to specify a number of other background properties?
Background
Each parameter of rgb() defines the intensity of colors between 0 to 256. State true or false.
False
True
multi-column
False
using which version developers can change and build their own version of bootstrap with all the provided styles?
which of the following is a mobile first front-end Framework for web development?
Bootstrap
which class combines sets of .btn-group into a button toolbar for including more Complex components?
.btn-toolbar
The __________ part is used to set the initial zoom level when the page is first loaded by the browser.
initial-scale=1
when you want to apply the style on an HTML element’s text same as heading, with bootstrap class you need to
choose?
.h1 to .h6
_________ class helps us to stand out a paragraph.
.lead
John wants to show a warning text in his web page. Choose the correct Bootstrap contextual class that helps to
perform the task.
text-warning
which of the following displays the text inside an <abbr> element in a slightly smaller font size?
.initialism
.caret
The ________ classes hide the element when the viewport is at the given breakpoint on a wider.
.hidden-*-up
when you want to indicate a big box for calling extra attention to some special content or information, you have to
apply the bootstrap's ________ class to a <div> tag
.jumbotron
The _________ class adds a rounded border around an element with a gray background color and some padding.
.well
Choose the common Standard rules for all form layouts provided by Bootstrap:
Add class .form-control to all textual <input>, <textarea>, and <select> elements
Wrap labels and form controls in <div class="form-group"> (needed for optimum spacing)
<script>
Dynamic web pages are created using ________.
server-side scripting
Where can you write the script tag inside the HTML?
client-side scripting
which of the following is true about typeof in javascript?
its value is a string that indicates the data type of the operand.
when the variable scope is available only within the method it is define, then that variable is called as local variable.
True
215
parselnt
______ is an event that happens when the user moves the mouse away from an element.
onmouseout
The name for all the Radio Objects must be the same, State True or False.
True
document.form.formName
document.formName
Function
Option
Which of the following functions returns the number downwards to its nearest integer value?
floor()
Which method of the array removes and returns the last element?
pop()
var y=str.lastIndexOf("a");
10
An object
function x()
var output=s.match(pattern);
document.write(output);
1,0,0
Navigator
Assume you have been assigned to develop a web site with lot of animations and effects, where you have to use
jQuery libraries. But for applying certain effects, you will have to make some changes in the library files. If so, which
version of the jQuery libraries should you use?
Development version
John, a web developer wants to select a single paragraph Element with the id 'p_id'. Help the John to choose the
correct code to perform the above task.
$(‘#p_id’)
$(document).ready(function()();
To prevent jQuery code from running before the document is fully loaded.
Look at the following jQuery selector: $("div #intro .head"). What does it select?
Which JavaScript function is equivalent, when you refer an HTML element using # (pound or hash) at the beginning?
getElementById
Which of the following methods helps us to attach one or more event handlers to a selected element?
on()
Ron, a web page designer, is developing a web page, where he wants to display one message when the mouse
pointer enters into a text field and display another message when the mouse pointer leaves the text box. Which
event will help him to perform these two operations together?
hover()
What is the correct jQuery code to set the background color of all paragraph elements to red?
$("p").css("background-color","red");
Which event will help to prevent any jQuery code from running before the document is finished loading (is ready)?
$(document).ready(function(){});
$(function(){ });
HTML 5
HTML stands for __________
Hyper Text Markup Language
What element is a container for all the head elements, and may include the document title, scripts, styles, meta
information, and more?
<head></head>
An application that lets you search and see material on the internet is
Browser
• <!DOCTYPE html>
<html>
<head>
<style type="text/css">
body
{
background-color:#DDFFAA;
}
h1{
font-style:italic;
text-align:center;
}
form
{
margin : 0 auto;
width:300px;
}
</style>
• </head>
<body >
<h1>Employee Appraisal Form</h1>
<form >
<table>
<tr>
<td>Employee ID</td>
<td><input type="text" name="employeeID" id="employeeID" required="required"> </td>
</tr>
• <tr>
<td>Employee Name</td>
<!-- Fill the attribute so that this text box takes a maximum of 30 characters -->
<td><input type="text" name="employeeName" id="employeeName" required="required" > </td>
</tr>
• <tr>
<td>Performance Rating</td>
<td><input type="number" name="rating" id="rating" min="0" max="10" ></td>
</tr>
• <tr>
<td>Email</td>
<td><input type="text" name="employeeEmail" id="employeeEmail" required="required" ></td>
</tr>
• <tr>
<td><input type="submit" name="submit" value="Save Appraisal"> </td>
<td><input type="reset" name="reset" value="Clear"> </td>
</tr>
• </table>
</form>
</body>
</html>
MobileNo number
Answer 1
Email-id email
Answer 2
PANNO text
Answer 3
Loan tenure range
Answer 4
Webaddress URL
Answer 5
Marital Status radio
Answer 6
MobileNo → number,
Email-id → email,
PANNO → text,
Webaddress → URL,
The phone number should accept only 10 digit numbers. Which of the following
option will suit.
<input type="text" pattern="[0-9]{10}"/>
In the web page we have a field called phoneno,inside the textbox we should have a value "Only numbers are
allowed", once we type the phoneno it should get disappered automatically.
Which of the below option will suit for the above scenario.
<input type="text" placeholder="Only numbers are allowed">,
CSS 3
Which of the following option is used to display the range value in the image as shown above.
Mark Range(1to100)<input type="range" name="mark" id="markInputId" min="1" max="100"
oninput="markOutputId.value = markInputId.value">
<output name="markOutputName" id="markOutputId"></output>
Consider the below code snippet:
<form action="success.html" novalidate="novalidate">
<input type="checkbox" name="Qualification" value="UG">UG<br>
<input type="checkbox" name="Qualification" value="PG">PG<br>
<input type="checkbox" name="Qualification" value="12th" required="required"> 12th<br>
</form>
The validation code has been written to check atleast one checkbox. If the code is not working, what could be
the reason ?
In the form attibute, we have given novalidate.
Which of the following tag provides a hint to the user of what can be entered in the field, on placing the cursor on
the corresponding field?
Placeholder
A book is implemented as a web page which has many topics in it.To make navigation to each topic easy,
hyperlinks needs to be provided in the page. Which of the following option will do that?
<a href="topic1.html">Topic 1</a> <br />
<a href="topic2.html">Topic.2</a> <br />
<span>
- Each parameter specifies the intensity of the color ranging from 0 to 255.
- It has an additional parameter alpha to specify the opacity of a color.
- Colors can be defined in Hue-Saturation-Lightness model using certain.
- is similar to RGBA model with alpha as an additional parameter notation.
[RGB colors] - Each parameter specifies the intensity of the color ranging from 0 to 255.
[RGBA colors] - It has an additional parameter alpha to specify the opacity of a color.
[ HSL colors] - Colors can be defined in Hue-Saturation-Lightness model using certain.
[HSLA model] - is similar to RGBA model with alpha as an additional parameter notation.
Write the correct css code for dividing the text in the <p> element into 3 columns in the web browsers like
Chrome, Safari, Opera and Firefox.
p{
-webkit-column-coun
: 3;
3
-moz-column-count: ;
column-count: 3;
}
-webkit-column-count
column-count: 3;
inline
When the styles are directly embedded in the tag itself using the style attribute then it is known as style
internal external
, style will be used if that style needs to be applied for that web page alone and style is that a
single file can be used to change the look of all the web pages of the application.
Inline
Internal
External
Re-arrange the code below in a correct order to display the content inside <p> tag in the following format:
Uppercase,Lowercase then capitalize
• <html>
<head>
• <style>
• p.uppercase
{
• text-transform: uppercase;
}
• p.lowercase {
• text-transform: lowercase;
• }
• p.capitalize {
text-transform: capitalize;
}
• </style>
</head>
</html>
Which vendor-prefix we have to use to set specific CSS3 properties to work on Mozilla Firefox browsers
in order to avoid the inconsistencies between various implementations?
-moz-
False
True
Provides a clean and uniform solution for building an interface for developers.,
It contains beautiful and functional built-in components which are easy to customize.
Bootstrap is a framework designed for building website, web applications with less effort. Bootstrap framework
focus more on building mobile website and web applications. State whether true or false.
True
True
14px
• <!DOCTYPE html>
<html lang="en">
• <head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
• <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
• <div class="container">
<h4>Input Groups</h4>
<form>
<div class="input-group">
• <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="email" type="text" class="form-control" name="email" placeholder="Email">
• </div>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
• <input id="password" type="password" class="form-control" name="password" placeholder="Password">
</div>
</form>
• </div>
</body>
</html>
.jumbotron : → It indicates a big box for calling extra attention to some special content or information,
.well : → It is a container in that causes the content to appear sinking or an inset effect on the page,
.panel : → It provides a flexible and extensible content container with multiple variants,
.initialism : → Displays the text inside an element in a slightly smaller font size
[.pagination] : To get pagination on your page you have to add this class
[.disabled] : We can customize links by this class for unclickable links
[.active ] : We can customize links by this class to indicate the current page
[.pagination-Ig] : Use this class to get large size item
[.pagination-sm] : Use this class to get small size item
<div> <ul> <a> <li>
To create a list group with linked items, use instead of and instead of
<div>
<ul>
<a>
<li>
The class that can be applied to button group instead of resizing each button. → .btn-group-lg,
Write the code to use glyphicon search icon anywhere in your program:
Hint: Use span class and apply necessary class alone.
Answer:
<span class="glyphicon glyphicon-search"></span>
.hidden-*-up .hidden-*-down
You can combine one class with one class to show an element only on a given
interval of screen sizes.
.hidden-*-up
.hidden-*-down
Which of the following contextual class is used for showing a dangerous action purpose?
.danger
The _____ class is used to add headers inside the dropdown menu.
.dropdown-header
True
True
The ______ is a feature to add appropriate spacing around the headings on a page.
page header
True
Which of the following class/classes applies hover effect to a specific row or cell of a table ?
.active
Yes
Java Script
When you want to enclose; some JavaScript statements to an HTML file, which is the correct tag you have
to use?
<SCRIPT>
Which of the below java script code helps to change the content of the paragraph tag dynamically?
David, a beginner in web development trying to perform one particular operation using client side
JavaScript. Choose the correct option(s) that he can't be done with client-side JavaScript?
When a user views a page containing a JavaScript program, which machine actually executes the script?
Sita wishes to greet the user when the user clicks on "Greet Me" button. In which event does she need to write the
JavaScript code for greeting the user?
Onclick
Which of the below statements are used to comment a line in CSS file?
/* this is a comment */
Drag and Drop the correct options:
[isNaN(0)] returns true is zero is a legal number otherwise returns false.
[String(obj))] converts the Boolean object “obj” into String object.
[escape()] function computes a new String in which certain characters from the given string have been replaced
by hexadecimal values.
[encodeURI()] function makes the respective URI as portable, so that it can be used across any network to any
computers.
[isFinite( )] function returns true if the input given is a legal finite number, otherwise returns false.
[parseInt (obj)] function converts the string object “obj” to an integer value.
Choose the correct options:
Client Side Scripting Language
JavaScript :
Client Side Scripting Language
VBScript :
Server Side Scripting Language
ASP :
Server Side Scripting Language
Perl-CGI :
Server Side Scripting Language
Python :
Server Side Scripting Language
PHP :
Client Side Scripting Language
Find any one character between the brackets → [abc], The Web page currently shown in the browser window →
Window
Rearrange the JavaScript code for storing and displaying the contents of two arrays.
• <script type="text/javascript">
• var n1=new Array(5);
var n2=new Array();
• for(var i=0;i<n1.length;i++)
• n1[i]=i;
for(var i=0;i<n1.length;i++)
• n2[i]=1;
displayArray(n1);
• displayArray(n2);
function displayArray(array){
• for(var i=0;i<array.length;i++)
• document.writeln(array[i]+" ");
}
</script>
Re-arrange the JavaScript code for checking whether a number is positive or negative or zero.
• <script type="text/javascript">
var no = 0;
• if( no==0) {
• document.write("The number is zero");
}
• else if(no>0) {
• document.write("The number is positive");
}
else {
• document.write("The number is negative");
}
</script>
Choose the correct JavaScript statement which helps you to write "World of JavaScript" in a web page?
document.write("World of JavaScript")
The parseInt() method converts the string to a integer. Before applying this function, Ram wants to know the
type of the argument that is passed to the function. Which operator in javascript would support this ?
typeof
Polson is allocated with the task of email validation in java script. He needs to extract character by character
and check for email validation like looking for @ . etc. Which method is best suited to extract every character
from the text?
charAt()
Ram is the developer of Allen Software company. He is designing the website for the banking application. There
is a button called 'check interest rates'. When that button is clicked, the user has to be redirected to a seperate
page to show the domestic interest rates. Help Ram in accomplishing this task using the javascript.
window.location
Which of the below is the correct syntax for exectuing some code if "amt" is equal to 5000?
if (amt == 5000)
Sita wishes to greet the user when the user clicks on "Greet Me" button. In which event does she need to write
the javascript code for greeting the user?
onclick
jQuery
When referencing an HTML element using jQuery preceded by a ‘ # ‘ , what JavaScript function is this equivalent
to?
getElementById
Which of the following is most appropriate tag in html 5 to divide the document into logical document groups?
<section></section>
If you want to change the color of a link to red when moving mouse pointer on top of it, which CSS property you
need to change?
a:hover{ color: red; }
The following elements are the new elements in HTML 5. These elements are called _____________
Semantic elements
Identify the correct jQuery events:
blur : → Form Event,
focus : → Form Event,
keypress : → Key Event,
hover : → Mouse Event,
scroll : → Window Event
Drag and drop the correct options:
[$("p > *") ] - This selector selects all elements that are children of a paragraph element
[$("div[p]")] - Selects all elements matched by <div> that contain an element matched by <p>
[$("p a.specialClass")] - This selector matches links with a class of specialClass declared within <p> elements
[$(":empty")] - Selects all elements that have no children
Re-arrange the jQuery code to hide and show the div tag with the id ‘div2’ which contains some html elements.
The form tag with the name ‘myForm’ contains a drop down box with the id ‘select1’ for setting the marital
status. When the user sets the marital status as ‘Married’ , then a div tag with the id ‘div2’ should be displayed
which contains the html elements for getting spouse name, no. of children, etc. If the user set the marital status
as ‘Unmarried’ , then it should hide the div tag.
Note:
<div> tag id : div2
Dropdown box id : #select1
Dropdown box name:mstate
Form name : myForm
• <script>
• $(document).ready(function() {
• $('#select1').change(function(){
var name=document.myForm.mstate.value;
• if(name=='Married'){
• $('#div2').show(); }
• else
• $('#div2').hide();
});
• });
</script>
fadeTo
The method adjusts opacity for the matched element.
slideUp
The mehod hides the matched elements with slide.
slideDown
The method shows the matched elements with slide.
fadeIn
The method shows the matched elements by fading it to opaque.
fadeTo
slideUp
slideDown
fadeIn
Write the correct jQuery code to select the specified element below:
Selects all elements that are the parent of another element, including text.
$(":parent")
If you are using $ in your own code, or are using another library, such as prototype, that uses $, you can call
_______ to restore $ to its original value.
jQuery.noConflict()
Animates the space between letters for all paragraphs with default duration of 400 milliseconds. Which jQuery
code accomplishes this task?
$("p").animate({letterSpacing:"15px"});
$("#name").remove(); This will remove the text field when you click on the button. State true or false.
True
Bind an event handler to the "blur" JavaScript event on an element.
.blur()
Rhita wants to replace a jQuery code '$(document).ready(fun)' using another equivalent method. Help her to find
the correct method from the given options.
$(fun)
When you don’t want people to click a submit button twice on a form, or you only want to allow them to do
something once on a page, what kind of functions you have to use for this?
$("#myElement").bind ('click', function() {});
$("#myElement").unbind('click');
John wants to animate (moving effect) an element in the webpage he designed. For this, he set its CSS position
property to its default value and applied the animations. If there is no syntax error in the code, what would be
output he gets?
Animation failed because the CSS position property set to default value,
Animation failed because the CSS position property set to static
Some people don’t want animation to interfere with their web page experience. What do I do if I want to let a
user turn off the animation?