-->

ABOUT US

Our development agency is committed to providing you the best service.

OUR TEAM

The awesome people behind our brand ... and their life motto.

  • Kumar Atul Jaiswal

    Ethical Hacker

    Hacking is a Speed of Innovation And Technology with Romance.

  • Kumar Atul Jaiswal

    CEO Of Hacking Truth

    Loopholes are every major Security,Just need to Understand it well.

  • Kumar Atul Jaiswal

    Web Developer

    Techonology is the best way to Change Everything, like Mindset Goal.

OUR SKILLS

We pride ourselves with strong, flexible and top notch skills.

Marketing

Development 90%
Design 80%
Marketing 70%

Websites

Development 90%
Design 80%
Marketing 70%

PR

Development 90%
Design 80%
Marketing 70%

ACHIEVEMENTS

We help our clients integrate, analyze, and use their data to improve their business.

150

GREAT PROJECTS

300

HAPPY CLIENTS

650

COFFEES DRUNK

1568

FACEBOOK LIKES

STRATEGY & CREATIVITY

Phasellus iaculis dolor nec urna nullam. Vivamus mattis blandit porttitor nullam.

PORTFOLIO

We pride ourselves on bringing a fresh perspective and effective marketing to each project.

  • Memory Subsystem in Computer Architecture


     

    Memory Subsystem

     

    Microcomputer Memory


    Memory is an essential component of the microcomputer system.
    It stores binary instructions and datum for the microcomputer.


    The memory is the place where the computer holds current programs and data that are in use. None technology is optimal in satisfying the memory requirements for a computer system.


    Computer memory exhibits perhaps the widest range of type, technology, organization, performance and cost of any feature of a computer system. The memory unit that communicates directly with the CPU is called main memory. Devices that provide backup storage are called auxiliary memory or secondary memory.



     

    Characteristics of memory systems


    • The memory system can be characterised with their Location, Capacity, Unit of transfer, Access method, Performance,
    • Physical type, Physical characteristics, Organisation.




    RAM, ROM, DRAM, Flash Memory


    • The main memory is a Random Access Memory. It is organized into words of fixed length.
    • The length of a word is called word length.
    • Each of these memory words has an independent address and each has the same number of bits.
    • Normally the total numbers of words in memory are some power of 2. Some typical memory word size are 8 bits, 16 bits, 32 bits etc.
    • The main memory can be both read and written into, therefore it is called read-write memory. 
    • The block diagram of a read- write memory of RAM is shown in figure. 

     

     


    memory subsystem


     

    The access time and cycle time in RAM are constant and independent of the location accessed. The computer places the address of the location into which the data are to be read into the memory address register. This register consist of n binary devices (generally flip-flops), where 2n is the number of words that can be stored in the memory. Example : A 32 × 4 RAM means that this RAM has 32 words, 5 address lines (25 = 32), and 4 bit data word size.



    Dram (Dynamic Random Access Memory)


    RAM technology is divided into two technologies : Dynamic and Static. A Dynamic RAM (DRAM) is made with cells that store data as charge on capacitors. The presence and absence of charge on capacitor is interpreted as binary 0 or 1. Since the capacitors have natural tendency to discharge Dynamic RAM requires periodic charge refreshing to maintain data storage.



    ROM (Read-Only Memory)


    A ROM is a memory or storage device in which a fixed set of binary information is stored. A ROM is a device with several input and output lines such that for each input value there is a unique output value. A block diagram of ROM is shown in the figure 3.


    It consist n input lines and m output lines. Each combination of the input variables in called an address. Each bit combination that comes out of
    the output lines in called a word. The number of bits per word is equal to the number of output lines m. The number of distinct address possible with n input
    variable is 2n.



     

    memory subsystem

     

     

    A ROM is characterized by the number of words (2n) and number of bits (m) per word. For example a 16 × 8 ROM which can be written as 24 × 8 consist of 16 words of 8 bit each, which mean there are 8 output lines and 16 distinct words stored in the unit. There are only 4 input lines because 16 = 24 and with 4 binary variable we can specify 16 address. A ROM is basically a combinational circuit and can be constructed as shown in figure 3 (c). On applying an Input I1 = 0, I2 = 0, the 00 line of the decoder is selected and we will get O1 = 0 and O2 = 1;
    on applying I1 = 0 and I2 = 1 we will get O1 = 1 and O2 = 0. The same logic is used for constructing larger ROM.




     

    Flash Memory :


    Flash Memory is a form of semiconductor memory which was first introduced
    in mid-1980. These memories can be reprogrammed at high speed and hence the
    name flash. These are electronic Random Access Memory but non-volatile in nature. 

    In flash memory the entire memory can be erased in a few seconds by using electric erasing technology. It is used in many I/O devices. It is also used to store data and programming algorithm in cell phones, digital cameras and MP3 music players. Basically flash memory falls in between EPROM and EEPROM.




    There are two kinds of flash memory :


    (i) Code storage flashmade by Intel, AMD, Atmel, etc. It stores
    programming algorithms and is largely found in cell phones 

    (ii) Data storage Flashmade by San Disk, Toshiba etc. It stores data and
    comes in digital cameras and MP3 players.

     

     

    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

  • Hierarchy of Memory

     

    Hierarchy of Memory


    Hierarchy of Memory


    Memory hierarchy Main Memory: memory unit that communicates directly with the CPU (RAM). Hierarchy of Memory


    Auxiliary Memory: device that provide backup storage (Disk Drives) Example of auxiliary memory: magnetic disks and tapes.  They are used for storing system programs, large data files, and other backup information  Only program programs and data currently needed by the processor reside in main memory.  All other information is stored in auxiliary memory and transferred to main memory when needed.


    Hierarchy of Memory



    Memory hierarchy system consists of all storage devices from the slow but high-capacity auxiliary memory to relatively faster main memory, to an even smaller and faster cache memory.

    Magnetic tapes used to store removable files and disks used as backup storage.  CPU communicates with auxiliary memory through I/O processor. 

     

    Cache Memory: special very-high-speed memory to increase the processing speed (Cache RAM)

    It is used to compensate the speed differential between main memory access time and processor logic.

    CPU logic is faster than main memory access.

    So small cache employed between CPU and main memory whose access time is close to processor logic clock cycle.

    So it is possible to increase the performance rate of the computer.

    As the storage capacity of the memory increases, the cost per bit for storing binary information decreases and the access time of the memory becomes longer.



    Example


    Auxiliary memory has a large storage capacity, is relatively inexpensive, but has low access speed compared to main memory.

    The cache memory is very small, relatively expensive, and has very high access speed.




    Goal of memory hierarchy


    To obtain the highest-possible average access speed while minimizing the total cost.




    Ratio


    Access time ratio between cache and main memory is about 1 to 7.


    For Example


    Cache memory may have an access time of 100ns, while main memory access time may be 700ns.

    Auxiliary memory average access time is usually 1000 times that of main memory.


    Block Size


    Block size in auxiliary memory typically ranges from 256 to 2048 words, while cache block size is typically from 1 to 16 words.




    Multiprogramming


    Multiprogramming refers to the existence of two or more programs in different parts of the memory hierarchy at the same time.

    For example, when one program is waiting for input or output transfer, there is another program ready to utilize the CPU.




    Memory management


    A program with its data normally resides in auxiliary memory. When the program or a segment of the program is to be executed, it is transferred to main memory to be executed by the CPU.  It is the task of the operating system to maintain in main memory a portion of this information that is currently active.
    3.  The part of the computer system that supervises the flow of information between auxiliary memory and main memory is called the memory management system.





    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     

  • Difference between RISC and CISC

     

    Difference between RISC and CISC


    What Is RISC?



    Reduction Instruction Set Computer (RISC) is a multiprocessor particularly designed to process limited computer instructions in order to operate at a much higher speed. On any given system, there are many programs and many instructions being executed. It was discovered that only 10% of all instructions were frequently executed, and that the other 90% clogged the pipeline, thus contributing to the system slowness.



    What Is CISC?



    Unlike the RISC model, Complex Instruction Set Computer (CISC) is a processor which is developed with a full (i.e. complex) set of instructions. The aim with this full instruction set is to provide the full processor capacity in the most efficient manner. RISC models proved, however, that better efficiency was achieved by reducing the set of instructions. 




    Difference between RISC and CISC

     

    RISC


    • Richer instruction set, some simple, some very complex.
    • Instructions generally take more than 1 clock to execute.
    • Instructions of a variable size.
    • Instruction interface with memory in multiple mechanism with complex addressing modes.
    • No pipelining
    • Upward compatibility with a family
    • Microcode control
    • Work well with simpler compiler.

     



    CISC



    • Simple primitive instructions and addressing modes.
    • Instructions execute in one clock cycle.
    • Uniformed length instructions and fixed instructions format.
    • Pipelining.
    • Instructions set is orthogonal (little overlapping of instructions functionality).
    • Hardwired control.
    • Complexity pushed to the compiler.





    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     


  • General Purpose Register



     

     

    What is a register?


    A register is one of a small set of data holding places that are part of a computer processor .



    A register may hold :

    a computer instruction
    a storage address
    or any kind of data (such as a bit sequence or individual characters)


    About Registers

    Rarely more than 64 registers in number.
    Small in size
    Typically a register is less than 64 bits in size



    General Purpose Registers Four general-purpose registers:

    1. AX
    2. BX
    3. CX
    4. DX




    AX (Accumulator)


    This is accumulator register. It is of 16 bits and is divided into two 8-bit registers AH and AL to also perform 8-bit instructions. It is used in arithmetic, logic and data transfer instructions in 8086 microprocessors. In manipulation and division, one of the numbers involved must be in AX or AL.




    BX (Base Register)


    This is the base register. It is of 16 bits and is divided into two 8-bit registers BH and BL. BX register is an address register. It usually contains a data pointer used for based, based indexed or register indirect addressing.




    CX (Count register)


    This is Count register. It is of 16 bits and is divided into two 8-bit registers CH and CL to also perform 8-bit instructions. This serves as a loop counter. Program loop constructions are facilitated by it. Count register can also be used as a counter in string manipulation and shift/rotate instruction.    




    DX (Data Register)


    This is data register. It is of 16 bits and is divided into two 8-bit registers DH and DL to also perform 8-bit instructions. Data register can be used as a port number in I/O operations. It is also used in multiplication and division.    




    SP (Stack Pointer)


    This is stack pointer register pointing to program stack. It is used in conjunction with SS for accessing the stack segment.  It is of 16 bits. It points to the topmost item of the stack. If the stack is empty the stack pointer will be (FFFE)H. Its offset address is relative to the stack segment.



    BP (Base Pointer)


    This is base pointer register pointing to data in stack segment. Unlike SP, we can use BP to access data in the other segments. It is of 16 bits. It is primarily used in accessing parameters passed by the stack. Its offset address is relative to the stack segment.




    SI (Source Index)


    This is source index register which is used to point to memory locations in the data segment addressed by DS. Thus, when we increment the contents of SI, we can easily access consecutive memory locations.  It is of 16 bits. Its offset is relative to the data segment.



    DI (Destination Index)


    This is destination index register performs the same function as SI. There is a class of instructions called string operations, that use DI to access the memory locations addressed by ES.


     

     

    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     

     

  • Ranchi University HTML Mid Sem Exam Paper with solution

     
    Ranchi University HTML Mid Sem Exam Paper with solution

     

     

     


     

     

     

    Group A

     

    1. <h6></h6> 

    2. <!DOCTYPE html>

    3. <!-- -->

    4. break the line

    5. meta

     

     

    Group B

     

    2. Design a login web page using HTML and CSS.

     

     

    <!DOCTYPE html>
    <html>
    <head>
    <title>Login Form</title>
    
    <style>
    
    body {
    	background: linear-gradient(to right, #1e5799 0%, #3ccdbb 20%, #16c9f6 100%);
    	
    }
    
    .form-css
    {
    	top: 50%;
    	left: 50%;
    	transform: translate(-50%, -50%);
    	position: absolute;
    	background-color: white;
    	border: 2px solid black;
    	border-radius: 20px;
    	padding: 50px;
    }
    
    
    .avatar-image img
    {
    	 justify-content: center;
    	 top: 0%;
    	 left: 50%;
    	 transform: translate(-0%, -50%);
    	position: absolute;
    	border: 1px solid black;
        border-radius: 50%;	
    	
    }
    
    button {
    	font-family: sans-serif;
    	padding: 5px;
    	cursor: pointer;
    }
    
    
    </style>
    
    
    
    
    </head>
    
    <body>
    <div class="container">
    
    <form action="controller/login-db.php" method="POST" class="form-css">
    <div class="avatar-image">
    <img src="image/avatar.png"  alt="avatar">
    </div>
    <br />
    <br />
    Email ID :
    <input type="text" name="email" placeholder="Enter your Email ID">
    <br />
    <br />
    Password :
    <input type="text" name="password" placeholder="Enter your password">
    <br />
    <br />
    <button type="submit" name="submit">Login</button>
    <br />
    <br />
    <a href="Signup.php">Signup Here</a>
    </form>
    </div>
    
    </body>
    </html>
    

     

     

     

    Ranchi University HTML Mid Sem Exam Paper with solution

     

     

     

    updating...

     

    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     

  • Ranchi University Java Mid Sem Exam Paper with solution


    Ranchi University Java Mid Sem Exam Paper with solution 
     
     
     

    Ranchi University Java Mid Sem Exam Paper with solution

     
     
    Ranchi University Java Mid Sem Exam Paper with solution


     

     
    1. Write using html and servlet to insert data in MySql database.


    A simple servlet code to accept values from a form and insert it into database using JDBC Code.

     

     

    <!DOCTYPE html>  
    <html>  
        <head>  
            <meta charset="ISO-8859-1">  
            <title>Insert title here</title>  
        </head>  
        <body>  
            <form method="Post" action="/Servlet">  
                <div>  
                    <label>Enter Movie Name: </label>  
                    <input type="text" name="name">  
                </div>  
                <div>  
                    <label>Enter Actor Name: </label>     
                    <input type="text" name="actor">  
                </div>  
                <div>  
                    <label>Enter Actress Name: </label>  
                    <input type="text" name="actress">    
                </div>  
                <div>  
                    <label>Enter Director Name: </label>      
                    <input type="text" name="director">  
                </div>  
                <div>  
                    <label>Enter Release Date: </label>   
                    <input type="text" name="rDate"blue>  
                </div>  
                <div>  
                    <label>Enter Rating Point: </label>  
                    <input type="text" name="rPoint">     
                </div>  
                <div>  
                    <input type="submit" value="Add movie">  
                </div>  
            </form>  
        </body>  
    </html> 
    
    
    
    

     

     

     

        import java.io.IOException;    
        import java.io.PrintWriter;    
        import java.sql.*;    
        import javax.servlet.ServletException;    
        import javax.servlet.annotation.WebServlet;    
        import javax.servlet.http.HttpServlet;    
        import javax.servlet.http.HttpServletRequest;    
        import javax.servlet.http.HttpServletResponse;    
            
           
        @WebServlet("/MovieServlet")    
        public class MovieServlet extends HttpServlet {    
            private static final long serialVersionUID = 1L;    
                   
               
            public MovieServlet() {    
                super();    
                // TODO Auto-generated constructor stub    
            }    
            
               
            protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {    
                // TODO Auto-generated method stub    
                response.getWriter().append("Served at: ").append(request.getContextPath());    
            }    
            
              
            protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {    
                    
                PrintWriter pw;    
                response.setContentType("text/html");    
                pw=response.getWriter();    
                    
                    
                String name=request.getParameter("name");    
                String actor=request.getParameter("actor");    
                String actress=request.getParameter("actress");    
                String director=request.getParameter("director");    
                String rDate=request.getParameter("rDate");    
                String rPoint=request.getParameter("rPoint");    
                float rating=Float.parseFloat(rPoint);    
                    
                    
                try    
                {    
                    Class.forName("com.mysql.jdbc.Driver");    
                    String url="jdbc:mysql://localhost:3306/mcapracticals";    
                    String user="root";    
                    String password="admin";    
                        
                    Connection con=DriverManager.getConnection(url, user, password);    
                    String query="Insert into movie(name,actor,actress,director,releaseDate,ratingPoint) values (?,?,?,?,?,?);";    
                    PreparedStatement pstmt=con.prepareStatement(query);    
                    pstmt.setString(1, name);    
                    pstmt.setString(2, actor);    
                    pstmt.setString(3,actress);    
                    pstmt.setString(4, director);    
                    pstmt.setString(5, rDate);    
                    pstmt.setFloat(6,rating);    
                        
                    int x=pstmt.executeUpdate();    
                        
                    if(x==1)    
                    {    
                    pw.println("Values Inserted Successfully");    
                    }    
                        
                }    
                catch(Exception e)    
                {    
                        e.printStackTrace();    
                }    
                    
                    
                pw.close();    
            }    
            
        }   
    

     

     

     

    Uploading.....

     


    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     

  • Python 1st mid sem exam of 3rd semester


    Python 1st mid sem exam of 3rd semester  under ranchi university

     

    Python 1st mid sem exam of 3rd semester Under Ranchi University

     

    Topics covered in this blog

    • Keywords and Identifiers
    • Data types and its function
    • List and its function
    • Dictionary and its function
    • Conditional construct
    • Indentation and Commands
    • Practical Question

     

     



    Keywords and Identifiers



    Python has a set of keywords that are reserved words that cannot be used as variable names, function names or any other identifiers.




    Keywords and Description


    and
    = A logical operator.

    as = The as keyword is used to create an alias. when importing the module. For example -
     

     

    import calendar as c
    print(c.month_name[1])
    

     

     

    We can refer to the calendar module and now we can refer to the calendar module by using a instead of calendar.


    assert = The assert keyword is used when debugging the code.

    The assert keyword lets you test if a condition in your code returns. True, if not, the programmer will raised an assertion error.

     

    For example - 
    
    x = "Hello"
    
    #if condition returns True, then nothing happens
    
    asser x == "Hello"
    
    #if condition returns false, assertion error is raised.
    
    assert x == "goodbye"
    
    

     


    break
    = To break out of a loop. For example
     

     

    for i in range(9):
        if i > 3:
           break
           print(i)
    
    
    

     


    class = To define a class. For example
     

     

    class Person:
          name = "Atul"
          age = 22
    

     

     


    Continue = This keyword is used to end the current iteration in a for loop (or a while loop) and continues to the next iteration.

    For Example
     

     

    for i in range(9):
        if i == 3: 
           continue
           print(i)
    

     


    def = def is used to define a function. For example
     

     

    def myfunction():
        print("Hello world!")
       
    
    myfunction
    

     



    del = To delete a class. For example
     

     

    class myclass:
          name = "Atul"
         
    
    del myclass
    print(myclass)
    
    
    

     



    output   

    NameError: name 'myclass' is not defined
     



    if = This keyword is used to create a conditional statement (if statement) and allows you to execute a block of code only if a condition is True.

     

    x = 5
    if x > 3:
       print("Yes")
    

     

     



    elif = This keyword is used in conditional statement and is short for else if. For example
     

     

    for i in range(-5, 5):
        if i > 0:
            print("Yes")
        elif i == 0:
            print("WHATEVER")
        else:
            print("No")
            
    

     


    else = This is used in also conditional statement. For example 

     

    x = 2
    if x > 3:
       print("Yes")
    else:
       print("No")
    

     

     



    except = Used with expectations, what to do when an exception occurs. For example
     

     

    try:
       x > 3
    except:
       print("Something went wrong")
       print("Even if it is raised an error, the program keeps running")
      
    
    

     

     


    NOTE = (x>3) will raise an error because x is not defined.


    output - Something went wrong...even if it raised an error, the program keeps running.    

     

     


    global = Declare a global variable inside a function and use it outside the function. For example
     


    def myfunction():
        global x
        x = "hello Atul"
        
        
    myfunction()
    
    print(x)
    
    
    

     


    import = import the datetime module and display the current date and time. For example
     

     

    import datetime
    
    x = datetime.datetime.now()
    print(x)
    
    

     

     
    in = The in keywork is used to check if a value is present in a sequence (list, range and string etc)

    The "in" keyword is also used to iterate thorugh a sequence in a for loop.

     

    fruits = ["apple", "banana", "cheery"]
    
    if "banana" in fruits:
        print("Yes")
        
    

     

     


    lambda keyword = The lambda keyword is used to create small anonymous functions.

    lambda function can take any number of argument, but can only have one expression.
     

     

    x = lambda a : a + 10
    print(x)
    

     

     

     

    Python Identifiers

     

    Python identifiers is the name we give to identify a variable, function class module or other object. This means whenever we want to give an entity a name, thats called identifier.



    so, myvariable
        variable_1
        variable_for_print



    • An identification start with the digit, so while variable1 is valid, 1variable is not valid.


    • We cant use special symbol !, #, @, %, $, etc in our identifiers.

     

    For Example


    x = int(input("Enter first number"))
    y = int(input("Enter second number"))
    sum = x + y
    print("The sum of x and y is " , sum)
    
    
    

     


    Q) wap to validate the credentials using python with userid and password

     

     

    def login():
         userid = input("Enter userid")
         pwd = input("Enter password")
         
         if(userid == "Atul" and pwd == "akku"):
            print("You are a valid user")
         else:
            print("You are not a valid user")
         
    
    login()
    

     

     

    Q) wap to display a largest number in python using(if, elif, else)

     

    def largest():
        x = int(input("Enter the value of x \n"))
        y= int(input("Enter the value of y \n")) 
        z = int(input("Enter the value of z \n"))
        
        if(x >= y and y >= z):
          print("x is greater than y")
        elif(y > x and y > z):
          print("y is greater than z")
        else:
          print("z is greater than of all among of them")
    
    largest()        
    
    

     

     


    List and its function



    List is a data type function which store any types of data such as integer, number, string etc.

    There is a so many functions in this list -


    • append()
    • insert()
    • clear()
    • count()
    • copy()
    • copy()
    • remove()
    • index()
    • reverse()
    • extend()



     

    append() = It is a function is used to insert an element and ethe end of the list.


    i = [5, 10, 15, 8, 21]
    i.append(30)
    print(i)
    
    
    

     


    output

    [5, 10, 15, 8, 21, 30]

     


    Insert
    = It is used to insert an element in a specific position in the insert(). Its contains two argument so first contains index number and second the elements.

     

     

    i = [5, 10, 15, 8, 21]
    i.insert(2, 6)
    print(i)
    
    
    

     


    output

    [5, 10, 6, 15, 8, 21]
     

     


    clear() = clear function is used to remove all the elements from the list.
     

     

    i = [5, 10, 15, 8, 21]
    i.clear()
    print(i)
    
    
    

     


    output


    []
     

     


    count() = It is used to count the number of times an element appear in the list. In this function we have to pass the elements name.

     

    i = [5, 10, 15, 8, 10 21]
    i.count(10)
    print(i)
    
    
    

     



    output

    2
     

     


    copy = copy is used to copy one list into another list.

     

    i = [5, 10, 15, 8, 10 21]
    j.copy()
    print(j)
    
    
    

     



    output

    [5, 10, 15, 8, 10 21]


     



    pop()
    = pop() function is used to remove an elements from specific position by passing its index number.


     

     

    i = [5, 10, 15, 8, 21]
    i.pop(2)
    print(i)
    
    
    

     

    output


    [5, 10, 8,21]


     



    remove() = remove function is used to remove an elements by passing the elements name in function.

     



    i = [5, 10, 15, 8, 21]
    i.remove(10)
    print(i)
    

     

     
    output


    [5, 15, 8, 21]




    index() = index() function is used to display the index number or position on the elements in the list. In this function we have to pass the elements name.

     

    i = [5, 10, 15, 8, 21]
    i.index(15)
    print(i)
    
    

     

     


    output


    2

     


    reverse() = reverse() function is used to reverse all of the elements in a list.


     

     

    i = [5, 10, 15, 8, 21]
    i.reverse()
    print(i)
    
    
    
    

     


    output

    [21, 8, 15, 10, 5]

     

     


    extend() = extend() is used to insert all the elements in the last position in the list.
     

     

    i = [5, 10, 15, 8, 21]
    name = ["atul", "hackingtruth"]
    i.extend(name)
    print(i)
    
    

     


    sort() = sort function is used to sort the elements in ascending order or descending order. By default, sort function store the
    elements in ascending order. If we want to display the elements in descending order then we have to use (reverse=true)
     

     

    i = [5, 10, 15, 8, 21]
    i.sort()
    print(i)
    

     

     


    output

    [5, 8, 10, 15, 21]
     

     

     

    In Descending order

     

    i = [5, 10, 15, 8, 21]
    i.sort(reverse=true)
    print(i)
    
    
    

     


    output

    [21, 15, 10, 8, 5]
     

     

     


    Dictionary and its function



    • Dictionary are used to store data values in key: value pairs.
    • Dictionary are written with curly brackets and have keys and values.
    • Dictionary items are ordered.
    • Dictionary are changeable meaning that we can change add or remove items after the dictionary has been created.
    • Duplicates values are not allowed.
    • Dictionary cannot have two items with the same keys.


    • clear()
    • copy()
    • get(keyname)
    • fromkeys()
    • keys()
    • values()
    • items()
    • pop()
    • popitems()
    • update()

     

     
    clear() = clear methods are used to remove all the elements from the dictionary list.

     

    cybersecurity = {
                   "brand" : "Hacking Truth",
                   "domain" : "hackingtruth.org",
                   "service" : "penetration testing"
                   }
                   
    
    cybersecurity.clear()
    
    

     


    output

    {}               
     

     


    copy() = copy function is used to copy one dictionary into another dictionary object.
     

     

    a = {"science" : 67, "maths" : 89}
    b = a.copy()
    print(a)
    print(b)
    
    

     


    output

    {"science" : 67, "maths" : 89}
    {"science" : 67, "maths" : 89}
     

     


    get() = The get method returns the value of the item with the based on key.
     

     

    car = {
            "brand" : "BMW",
            "model" : "Mustand",
            "year" : "1964"
          }
          
          
    x = car.get("model")
    print(x)
    

     

     


    output

    mustang
     
     

     


    fromkey() = It is used to create a dictionary based on the key variable and values variable.
     


    key = [1, 2, 3]
    value = {"java", "c++", "android"}
    dict = fromkeys(key, value)
    print(dict)
    
    
    

     

     
    output

    1 : "java", 2 : "c++", 3 : "android"



     


    keys() = It is used to returns all the keys from the dictionary.
     

     

    dict = {a : "atul", b : "kumar"}
    print(dict.keys())
    
    

     


    output


    dict_keys(['a', 'b'])
     

     


    values() = values is used to return all the value from the dictionary.
     

     

    dict = {1: "java", 2: "c++", 3: "android"}
    value = dict.values()
    print(value)
    
    
    

     


    output

    (["java", "c++", "android"])
     

     

     
    item() = item() is used to return all the keys and value

     

      
    dict = {1: "java", 2: "android"}
    item = dict.items()
    print(item)
    
    
      

     



    pop() = pop() is used to remove an element based on the key path.
     

     

    hisdict = {
              "brand" : "ford",
              "model" : "mustand",
              "year" : "1964"
              }
              
    hisdict.popitem()
    print(hisdict)
    
    

     

     



    output

    {"brand" : "ford", "model" : "mustand"}
     

     

     


    Conditional construct



    In conditional construct python is a block of executed condition become true if condition is becoming not true if check all the elif blocks

    If any of one elif block become true it will print the statement of respective elif block.

    If none of the elif block becming true it executes the else block to define the condition construct. We have to write if inside the paramter and terminate will colon (:) symbol.


    if(avg >= 75):
     

    The body of the construct starts with indentation or block space is space of curly braces.

     

     

    sub1 = int("Enter the marks of student1")
    sub2 = int("Enter the marks of student2")
    sub3 = int("Enter the marks of student3")
    
    
    
    avg = (sub1 + sub2 + sub3)/3
    
    if(avg >= 75):
       print("Grade A")
    elif(avg >= 60 and avg < 75):
       print("Grade B")
    elif(avg >= 50 and avg < 60):
       print("Grade C")
    else:
       print("Grade D")
      
    
    

     



    For loop = for i in marks:

    i = variable (iterate, traverse)
    marks = sequence(list, tuple)
     

     


    In python for loop is used to iterate or traverse in the element of sequence. The sequence can be list tuple, list, dictionary or any string data type. We can stop the execution of for loop by using the break statement.

    We can also give else block in for statement and the else block will block when all the condition becomes false even break statement also.
     

     

      
    For example1
    
    num = [5, 10, 15 ,20]
    for i in num:
        print(i)
    
    
    
    For example2
    
    num = [5, 10, 15, 20]
    sum = 0
    for i in num:
         sum = sum + i
         
    print("sum is " , sum)
    
    
    marks = {"Atul" : 85, "hackingtruth" : 99}
    
    name = input("Enter a name")
    
    for student in marks:
         if(student == name):
            print(marks[student])
            break
         else:
            print("No such name exit")   
    
    
    
    
      
      

     

     

    Practical Question

     

    1Q) wap to add, mul, sub, divide using function ?

     

     

    #!/usr/bin/python
    
    a = int(input("Enter first value : "))
    b = int(input("Enter second value : "))
    
    def add():
        c = a + b
    #    a = 5 + 5
        print("The sum of a and b is : " , c)
    
    def sub():
        c = a - b
    #    b = 5 - 5
        print("The subtraction of a and b is : " , c)
    
    def mul():
        c = a * b 
    #    c = 5 * 5
        print("The multiplication of a and b is : " , c)
    
    def div():
        c = a / b
    #    d =  5 / 5
        print("The division of a and b is : " , c)
    
    
    add()
    sub()
    mul()
    div() 
     

     




    Python 1st mid sem exam of 3rd semester




    2Q) wap to validate a user using dictionary?

     

     

    #!/usr/bin/python
    
    Dict = {"atul" : "atul143", "hackerboy" : "hackerboy143" }
    
    a = input("Enter the username : ")
    b = input("Enter the password : ")
    
    if a and b not in Dict:
       print("You are a valid user")
    else:
       print("You are not a valid user") 
     
     
     

     Python 1st mid sem exam of 3rd semester

     

     

    3Q) wap to using Tk() function interface to add the number?

     

     

     

    from tkinter import *
    
    win = Tk()
    win.geometry("400x400")
    
    Label(win, text="Your First Number:").grid(row=0, column=0)
    Label(win, text="Your Second Number:").grid(row=1, column=0)
    
    # define the label, step 1
    label3 = Label(win)
    
    # set grid, step 2
    label3.grid(row=3, column=1)
    
    first_no = IntVar()
    second_no = IntVar()
    
    
    
    # same goes for here
    e1 = Entry(win, textvariable=first_no).grid(row=0, column=1)
    e2 = Entry(win, textvariable=second_no).grid(row=1, column=1)
    
    
    def add():
        sum = first_no.get() + second_no.get()
        label3.config(text="your final number is:" + str(sum))
    
    mybutton = Button(win, text=("Calculate!"), command=add).grid(row=2, column=1)
    
    win.mainloop()
    
    

     

     

     


     

     

     5Q) wap in python using append, remove, reverse and extend list item?

     

     

    #!/usr/bin/python
    
    listitem = [5, 10, 15, 8, 21]
    print("Before performing the operation " , listitem)
    
    #append
    
    listitem.append(30)
    print("After appending some values : " , listitem)
    
    #remove
    
    listitem.remove(15)
    print("Now, Removing 15 no element from list : " , listitem)
    #
    #reverse
    
    listitem.reverse()
    print("After reversing values : " , listitem)
    
    #extend
    
    name = ["atul", "hackingtruth"]
    listitem.extend(name)
    print("after using extending func : " , listitem)
    
    

     

     

     

    Python 1st mid sem exam of 3rd semester

     

     

     

    6Q) wap to insert product ID, product name and product price in list date types and display it?


     

    #!/usr/bin/python
    
    pid = int(input("Enter the product id (1, 2, 3...) : "))
    pname = input("Enter the  product name : ")
    pprice = input("Enter the product price : ")
    
    list1 = []
    
    list1.append(pid)
    list1.append(pname)
    list1.append(pprice)
    print(list1)
    
    
    

     

     

     

    Python 1st mid sem exam of 3rd semester



     

     

     

    7Q) wap to create a dictionary and add all of the value and also display maximum and minimum value?

     

     

    #!/usr/bin/python
    
    Dict = {"x" : 50, "y" : 60, "z" : 45}
    print(Dict)
    total = 0
    for i in Dict.values():
        total = total + i
    
    print("Sum " , total)
    print("The maximum value is " , max(Dict.values()))
    print("The Minimum value is " , min(Dict.values()))
    
    

     

     

     

     Python 1st mid sem exam of 3rd semester

     

     

    8Q) create a dictionary and add some item in dictionary and display it?

     

     

    #!/usr/bin/python3
    
    a = input("Enter the key attribute name : ")
    b = input("Enter the value of key attribute : ")
    
    Dict = {}
    Dict.update({a : b})
    print(Dict)
    
    
    

     

    Python 1st mid sem exam of 3rd semester

     

     

     

    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

  • WHAT WE DO

    We've been developing corporate tailored services for clients for 30 years.

    CONTACT US

    For enquiries you can contact us in several different ways. Contact details are below.

    Hacking Truth.in

    • Street :Road Street 00
    • Person :Person
    • Phone :+045 123 755 755
    • Country :POLAND
    • Email :contact@heaven.com

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.