# Knowledge check: Time complexity

1. **Which has the largest time to compute?**
    
    * O(1)
        
    * <mark>O(N)</mark>
        
    * O(log n)
        
2. **Given the following lines of code pseudocode;**
    
    ```apache
    N = 7 
    
    FOR i = 1 TO N:
    
          output(i)
    ```
    
    * <mark>O(N)</mark>
        
    * O(n^2)
        
    * O(1)
        
3. **Given the following lines of code pseudocode;**
    
    ```apache
    N = 7 
    
    FOR i = 1 TO N:
    
          FOR j = 1 TO N:
    
             output(N)
    ```
    
    * <mark>O(n^2)</mark>
        
    * O(1)
        
    * O(N)
        
4. Given the following lines of code pseudocode:
    
    ```apache
    N = 37 
    
    FOR i = 1 TO N:
    
          j = 1
    
          WHILE j < 10:
    
             output(j*N)
    
             j = j + 1
    ```
    
    * **O(n^2)**
        
    * **<mark>O(N)</mark>**
        
    * **O(1)**
        
5. Given the following lines of code pseudocode:
    
    ```apache
    N = 10 
    
    FOR i = 1 TO 5:
    
            FOR j = 1 TO i:
    
                    output(i*j)
    ```
    
    * O(n^2)
        
    * <mark>O(1)</mark>
        
    * O(Log N)
        
6. **Given the following lines of code pseudocode:**                                     `output(N)`
    
    ```apache
    N = 7 
    
    FOR i = 1 TO N:
    
               FOR j = 1 TO N:
    
                    output(N)
    ```
    
    * O(1)
        
    * O(N)
        
    * <mark>O(n^2)</mark>
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1728193304949/05f79f39-5554-4506-9729-966f9fad627e.png align="center")
