Search This Blog

Python Hackerrank Sulution Quiz Answers

1. A sample module named sample_module.py contained the following contents.
def mul(x, y):
    """Multiplies two given numbers and returns the product.
    >>> mul(6, 7)
    42
    >>> mul(-8, 7)
    >>> -56
    """
    return x * y
What is the expected output when you run the doctests using below command?
python -m doctest sample_module.py

2. Which of the following doctest directive is used for not considering or executing a specific doctest?

3. Which of the following doctest directive is used to deal with unexpected whitespace that appears in the output?

4. Which of the following is a docstring?

5. Which of the following special attribute can be used to access a doc string in a program?














Software Testing in Python


1. Software Testing is a process of identifying bugs in an application by running the application through a series of designed tests.


2. Software Testing involves multiple stake holders such as testers, management, business, customers, consultants, and end users.

Why Software Testing Required?

Software Testing is very important for the following reasons:

  • It can detect errors or defects made during development phase.

  • It increases reliability and quality of the software.

  • It validates or checks if software is behaving as expected based on requirements.

  • It is required for effective performance of software application.



Software Testing Life Cycle

Software Testing Life Cycle (STLC) refers to various phases involved in testing of a software.

STLC in general includes the following phases:

  • Requirements Review

  • Test Planning

  • Test Designing

  • Test Environment Set Up

  • Test Execution

  • Test Reporting


Testing is generally classified into three levels based on the component being tested.

The three levels are:

  • Unit Testing
  • Integration Testing
  • System Testing


Unit Testing
  • Unit Testing : Testing the smallest possible code snippets of a program.

  • Practically, breaking down of these code snippets into further smaller pieces is not achievable.

  • For e.g: considering below function as a single unit makes sense.

def square(n):
    "Returns square of a number."
    return n**2


Integration Testing
  • Integration Testing : It focuses on testing interactions across related units.

  • These tests are still run in isolation in order to overcome inputs from outside or other units.

  • The inputs required from outside units are simulated.




System Testing
  • System Testing : It checks parts of the program once all units are plugged together.

  • It is an extreme form of Integration Testing.

  • System tests will not be useful, if these tests are not supported by the results of integration tests and unit tests.


Acceptance Testing
  • Unit TestingIntegration Testing and System Testing are done to verify software product as a whole or it's individual components.

  • On the other hand, the testing that you perform to confirm that the software behaves as expected is known Acceptance Testing.

  • Acceptance Testing doesn't check any core functionality of the software, it only aims at checking the software behavior.


Regression Testing
  • Regression Testing is another type of testing which ensures that previously built software performs the same way after making some changes to it or interfacing it with other software.

  • Regression Tests can be written before or after a bug is found.

  • They provide an assurance that an increase in a program's complexity doesn't introduce new bugs.

Tests in Python :

  • doctest : It is the simplest framework which combines documentation and tests.

  • unittest : It is the framework having xUnit-Style architecture.

  • nose : It extends unittest and makes testing easier.

  • pytest : It has a rich set of useful plugins and is compatible with unittest and nose.







BASIC BASIS Tcodes for beginners

 SM51: (Application Server)

Transaction code SM51 is to display list of active application servers that have registered in the SAP message server. Further, you can manage & display the status, users, work process in all application servers belonging to the SAP System.

• Processes: Display & control work process. [SM50]

• User: Display & manage user sessions. [SM04]

• SNC Status: Display SNC status.

• Release Notes: Display detailed release information for an application server.

• Remote Logon: Log on by any server in the system; you can see the server where you are logged on in the status bar in the second entry from the left.

• System Log: System logs. [SM21]

Source: http://itsiti.com/sm51-sap-server-overview

___________________________________________________________________________________

SM50: (Work process monitor - single instance)

Transaction code SM50 is used to monitor and manage work processes. In the work process overview, you can:


• End an ABAP program that is running.

• Debug an ABAP program that is running.

• Cancel a process (with or without core) – long running jobs

• End a session

• Activate/deactivate the restart option after an error

• Execute various functions for the process trace

___________________________________________________________________________________

SM66: (Work process monitor - overall instance) 2 states - waiting and running 

Transaction code SM66 is used to quickly investigate the potential cause of a system performance problem by checking the work process load. You can use the global work process overview to:

• Monitor the work process load on all active instances across the system
• Identify locks in the database (lock waits).

Using the Global Work Process Overview screen, you can see at a glance:

• The status of each application server
• The reason why it is not running
• Whether it has been restarted
• The CPU and request run time
• The user who has logged on and the client that they logged on to
• The report that is running

_________________________________________________________________________

ST22: (ABAP dumps)

You can use the tools of the ABAP dump analysis (ST22) to list the ABAP runtime errors that have occurred in an ABAP system as well as the relevant short dumps.

  • Displays and analyzes update statistics again

  • Save in a local file

  • Print

  • Store for a longer period of time

__________________________________________________________________________

SM37: (Monitor background jobs, monitor overrunning jobs)

Transaction code SM37 is to monitor the backgroundbatch jobs running in the system.

1. From the initial screen, you can search by the job name, user name or program name accordingly with the time condition.

Note

• Planned - Job already been defined, but the start condition has not yet been defined.
• Released - The job has been fully defined, including a start condition.
• Ready - The start condition of a released job has been met. A job scheduler has put the job in line to wait for an available background work process.
• Active - The job is currently running. Active jobs can no longer be modified or deleted.
• Finished - All steps that make up this job have completed successfully.
• Canceled - The job has terminated. This can happen in two ways:
- An administrator intentionally terminates the job
- A job step contains a program that produces an error, such as:
* an E or A error message in an ABAP program
* a failure return code from an external SAPXPG program

Source: http://itsiti.com/sm37-background-batch-jobs

__________________________________________________________________________________________________________________

SM04: (User monitor - single instance)


Transaction code SM04 shows the list of the users which are logged on to the instance in which are currently logged in. The total number of users and sessions are given at the bottom of the list.

Note

• Client: SAP Client.
• User: User logged on to server (SAP user name).
• Terminal: Terminal at which the user is working. (If it is a UNIX frontend, the terminal name corresponds to the display variable of the frontend process; if it is a Windows or OS/2 frontend, the terminal name corresponds to the host name on which the frontend was started.)
• TCode: Last executed SAP transaction (transaction code).
• Time: Time at which the user last initiated a dialog step by entering data.
• Sessions: Number of external sessions (session) opened by the user (up to 6). You can display detailed information on a session by selecting a user and choosing the Sessions button.
• Ty: Connection type (GUI, RFC or Plugin (HTTP or SMTP request).
• MByte: Size of the memory allocated to the user in megabytes.

Source: http://itsiti.com/sm04-user-list

__________________________________________________________________________________________________________________

AL08: (User monitor - multiple instance)


Transaction code AL08 shows the list of all the users who are logged on to the system globally or for all the instances in the system which are active.

• Active instance – Shows the Active instance.
• Active users – Displays the active users logged on to the active instance.
• Interactive users – Displays the Dialog users logged on to the active instance.
• RFC users – Display the users that are connected via RFC on the active instance.
• Mand – Client number.
• User – User name of users logged on.
• Terminal – From which Terminal/machine user has logged on.
• T-code – Last executed transaction code.
• Time – The time when a user last initiated a dialog step by entering data.
• External Sessions – Number of External sessions the user has opened. It use SAP memory to share data between external sessions and it based on per main window. An external session is started when starting a program and when ever the use of CALL TRANSACTION. Each user can open maximum 6 SAP system windows in a single SAPGUI session. Each of these windows corresponds to a session on the application server with its own area of shared memory. The session can be created by System -> Create Session.
• Internal Sessions – Number of Internal sessions the user has opened. A session that with in external session. There can be many internal sessions in an external session. ABAP MEMORY is used to exchange the data between internal sessions. When calling a program using SUBMIT or CALL Transaction, it will be loaded in a new internal session.

Source: http://itsiti.com/al08-list-of-all-users-logged-on

__________________________________________________________________________________________________________________

SM13: (Update Process)


Transaction code SM13 is a update management transaction which is used for:

• Display update requests
• Analyze problems pertaining to the update
• Test and debug canceled update requests
• Display and reset the status of update requests
• Delete update requests
• Display statistics on updates

__________________________________________________________________________________________________________________

SM12: (lock entry monitor)


The SAP System is equipped with a special lock mechanism that synchronizes access to data on the database. The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously. Lock entries are usually set and deleted automatically when user programs access a data object & release it again. The lock mechanism is closely related to the Update Mechanism.

1. You can use SM12 to check and delete lock entries.

2. In SM12, check any lock entry older > 2 days. If any outdated entry found, check the corresponding user is user online/offline in AL08 or SM04 (you can get the transaction code that been use by the user). Get the user contact from SU01 and inform about the lock else if the user is offline, release the table from lock by deleting the lock.

__________________________________________________________________________________________________________________

DB12: (Database monitor, backup check, Backup logs overview)


Transaction code DB12 is to collects and presents information that is necessary to monitor database backups. It is an important source of information for the database administrator who has the task of supervising the execution of a defined backup strategy.

On the initial screen of the monitor, it shows overview of important information related to SAP database backups.

• The last successful backups for the SAP, master and msdb databases and transaction logs.
• The last SAP database size and duration of the backup job.
• Whether the SQL Server Agent is started or not.
• The amount of log space allocated and how much is still free.
• The Recovery interval, which specifies the maximum time that SQL Server should spend recovering after a database startup.

1. Examination Data

1. Examination Data

There is a database with exam scores. Write a query to print the names of the students who scored an even number of marks. The names should be listed in uppercase, alphabetically ascending. The result should be in the following format: NAME MARKS

Schema

There is 1 table: exam

exam
NameTypeDescription
NAMESTRINGThis is the student name. It is the primary key.
MARKSINTEGERThese are the marks obtained.

Sample Data Tables
exam
NAMEMARKS
Julia10
Samantha6
Jack15


 

Sample Output

JULIA 10
SAMANTHA 6

Explanation

  • Julia and Samantha have an even number of marks, so they are included in the query.



ANSWER:


/*
Enter your query below.
Please append a semicolon ";" at the end of the query
*/
select UPPER(NAME), MARKS from EXAM
where MARKS%2 = 0
order by NAME ASC;












SAP ABAP Function Modules Quiz Fresco Play HackerRank Solutions

 Q.1  We need not to write the same code again and again in all the programs using ____________

  1. Copy paste technique
  2. Polymorphism technique 
  3. Modularization technique
  4. None of these
Q.2 State true or false, Unlike Include Programs, Function Modules can be executed independently
  1. False
  2. True
Q.3 All of the function modules in function group can access the ___________ of the group
  1. global data
  2. local data
  3. None of these
  4. both local and global data
Q.4 A ____________ is a set of procedures defined in the Function Groups
  1. Function Builder
  2. data dictionary
  3. Function Modules
  4. Screen Painter
Q.5 State true of false. A function group contains logically related Function Modules
  1. True
  2. False
Q.6 Using function modules helps us in ____________
  1. easy transfer of code
  2. complexing the structure
  3. code reusability
  4. All of these
Q.7 State True of  False. A Function Group cannot be executed
  1. True
  2. False
Q.8 Modularization techniques are
  1. Subroutines
  2. Includes
  3. Function Modules
  4. All of these
Q.9 Function Module which can be used by any ABAP program in the same system to process data
  1. Normal Function
  2. Update Module
  3. Remote Enabled Function
  4. None of these
Q.10 A _________ is a container of function modules
  1. ABAP Easy Access screen
  2. Function Group
  3. Package
  4. Program 




SAP BASIS - Overview

 Overview:

Sap Basis refers to the administration of SAP system that includes activities like installation and configuration, load balancing, and performance of SAP applications running on Java stack and SAP ABAP

The key responsibilities of SAP Basis Administrator include - 

  • SAP Client Administration
  • SAP User Management
  • Installation and Configuration
  • SAP Patch Management
  • Transport Management
  • System Monitoring 

10 Important terms of stock market for beginners - 5

 Important Terms

  1. SEBI - The regulator for capital market
  2. Depositors
  3. Depository Participants
  4. FII - Foreign Institutional Investors
  5. Credit Rating Agency (CRA)
  6. Merchant Bankers
  7. Asset Management Companies(AMC)
  8. NSCCL and ICCL
  9. Market Participants
  10. Where to Invest ? (Asset Class)

1. The Security and Exchange board of India (SEBI)

Objective -
  • Development of stock exchange
  • To protect the interests of retails investors
  • To regulate the activities of Market participant and financial intermediaries.
We can think that if there are no rules and regulations in stock market then there will be a big problem like liquidity damages, financial loss, trust loss and many more. Nobody will invest in stock. To regulate and make new rules which can be regulate market, SEBI is established. SEBI is a bridle in share market.

Financial Regulators in India

1. RBI - Reserve Bank of India
   Sector: Banking & Finance, Monetary Policy

2. SEBI - Securities and Exchange Board of India
   Sector: Securities (Stock) & Capital Market & Mutual Funds

3. IRDAI - Insurance Regulatory and Development Authority
   Sector: Insurance

4. PFRDA - Pension Fund Regulatory and Development Authority

5. NHB - National Housing Bank Sector: Financial Housing

2. Market Participants

  • Domestic Retail Participants
  • NRI's 
  • Domestic Institution
  • Domestic AMC (asset management Companies)
  • FIIS - Foreign Institutional Investors

3. Depositories

Example : NSDL and CDSL

What do they do?   : Safekeeping,  
                                    Reporting and settlement of client securities
In general:    Acts like a vault for the shares that you buy. The depositories hold your shares and facilitate exchange of your securities. When you buy shares these shares sit in your Depository account usually referred to as the DEMAT account. This is maintained electronically by only two companies in India.

4. Depository Participants

Example: Most banks and few stock brokers

What do they do? :  Acts as an agent to the two depositories

In general : You cannot directly interact with NSDL or CDSL. You need DP to open and maintain DEMAT account.

5. Foreign Institutional Investors:

Example: 

a) Foreign Corporate,

b) Funds,

c) Individual

What do they do? : Make investment in India

6. Credit Rating Agency(CRA):

Example: 
a) CRISIL
b) ICRA
c) CARE

What do they do? : They rate the credit worthiness of corporate and governments

7. Merchant Bankers:

What do they do? : Help companies raise money in the primary markets

In general: if a plans to raise money by floating an IPO, then merchant bankers are the one who help companies with the IPO process

8. Asset Management Companies(AMC):

Example: 
a) ICICI AMC
b) Reliance Capital
c) AB Capital

What do they do?: Offer Mutual Funds Schemes

9. NSCCL and ICCL: National Security Clearing Corporation Ltd. (NSCCL) 

                                      Indian Clearing Corporation (ICCL)

10. Where to Invest?:

Asset Class
  1. Fixed Income Instruments
  2. Equity
  3. Real Estate
  4. Commodity-Bullion

 

What is Demat & Trading Account ? Difference between Trading & Demat Account - 4

 Portfolio :

1. Demat Account and Trading Account
2. What should you look before opening Demat account
3. Documents Required

Before many days ago there were not online procedure, that time there were only paper work. For that we needed material. This was too lengthy procedure like make a sign and weight for many days like that. But now it is dematerialized (De-Material).
Demat account is like a bank account. We can compare it. If we deposit fund in bank then in electronic format money exists in bank similarly in Stock market we need electronic money.

Difference between Demat and Trading Account:































Documents Required:

  • Pan Card (Must)
  • Aadhar Card or any other address proof
  • Bank Statement for (Future & Options)
  • Cancel Cheque if required
All process is online

How to know size of the company in Stock Market? What is Market Capitalization? - 3

     In previous post we have seen what is weighted average. If you still don't know then please refer previous post. In short I'll explain, how much percentage should be in Nifty/Sensex from which sector?     

    Directly we'll dive into core part . . . . . . .

I'll give you example of two companies. Tell me which company is bigger or which company's value is more?

1. MRF

79890.20 as on 4/20/2021

2. TCS

3157.25 as on 4/20/2021

MRF is a company which produces tires and TCS is a software company. By overlooking these two companies and on the basis of share price we can say that MRF is a bigger than TCS but it is absolutely wrong.
To know which company is bigger we'll go through a formula:

Market Capitalization = Total No. of Outstanding Share * Current Share Price

Total no. of outstanding shares refer to a company's stock currently held by its all stakeholders.

 For example:

Company ABC
  • Total no. of Outstanding Share = 100 Cr
  • Current Share Price = 50
So clearly we can say that compony is of 5000 Cr (100*50) 

Company XYZ
  • Total no. of Outstanding Share = 1000 Cr
  • Current Share Price = 30
With the help of market capitalization formula - we can say that company is of 30000 Cr

I mean that, XYZ company's share price is less than ABC company but value is more than ABC.  Because total no of outstanding shares are more. I think you got the point. TCS has more no of shares that's why TCS is bigger than MRF