Join Regular Classroom : Visit ClassroomTech

Texas Instrument Interview Questions + Coding Solutions – codewindow.in

Hot Topics

Texas Instrument Solution

Technical Round

In how many ways one can design NOT gate? Describe them briefly.

There are several ways to design a NOT gate:
  1. Using a transistor: A NOT gate can be designed using a bipolar junction transistor (BJT) or a field-effect transistor (FET) in its common-emitter, common-base, or common-source configuration.
  2. Using a diode: A NOT gate can be designed using a diode in its switching or rectifying configuration.
  3. Using a relay: A NOT gate can be designed using a relay by connecting it in normally open or normally closed configurations.
  4. Using digital circuits: A NOT gate can be designed using digital circuits like gates, flip-flops, and counters.
    1. Using operational amplifiers (Op-Amps): A NOT gate can be designed using an Op-Amp in its inverting or non-inverting configuration.
    Each of these design approaches has its own advantages and limitations. The choice of the design method depends on the requirements of the application, including the desired speed, power consumption, and cost.

Given an array of 999 numbers with each number being unique and in the range of 1-1000. What is the most optimum way to find the missing number?

One approach to finding the missing number in the given array is to use the mathematical formula for the sum of an arithmetic series, which is (minimum number + maximum number) * (number of terms) / 2, and compare it to the sum of the numbers in the array. The missing number will be the difference between the expected sum and the actual sum. Here’s an example in Python:
def find_missing_number(arr):
    n = len(arr)
    expected_sum = (1 + 1000) * 1000 // 2
    actual_sum = sum(arr)
    return expected_sum - actual_sum

arr = [1, 2, 3, ..., 999]
missing_number = find_missing_number(arr)
print("The missing number is:", missing_number)
This approach has a time complexity of O(n) and a space complexity of O(1), making it an efficient solution for finding the missing number in the given array.

What is the problem with the following code? char[10] input; cin >> input;

The code you provided is missing the data type for the input array and is using the cin operator, which reads input as a string, to assign a value to the array of characters.
There are several problems with this code:
  1. The size of the input array is not specified: The size of the array should be 11 to allow for 10 characters and a null terminator.
  2. The cin operator cannot be used to directly assign values to an array of characters: The cin operator reads input as a string and does not stop reading when it encounters a whitespace character. This means that if you enter a string with more than 10 characters, it will overflow the input array and cause undefined behavior.
To solve these problems, you can use the getline function to read input into a string and then copy the first 10 characters into the input array:
char input[11];
string input_string;
getline(cin, input_string);

int length = min(10, (int)input_string.length());
for (int i = 0; i < length; i++) {
    input[i] = input_string[i];
}
input[length] = '\0';
This code reads a line of input into the input_string variable and then copies the first 10 characters into the input array, followed by a null terminator.

Describe a project that you worked on.

Explain Your Project.

Conversion of d flip-flop to jk flip-flop.

A D flip-flop can be converted to a JK flip-flop by adding an inverter to the inputs. A JK flip-flop is a type of flip-flop that has two inputs, J and K, that can be used to set, reset, or toggle the output.
      +------+      +------+
 D --->| INV  |----->| J    |
      +------+      +------+
In this diagram, the output of the inverter is connected to the J input of the JK flip-flop. The K input of the JK flip-flop is connected to VCC (logic 1).
The truth table for this conversion is as follows:
D | Q(t) | J | K | Q(t+1)
-----------------------------
0 |   0  | 1 | 0 |    1
0 |   1  | 1 | 0 |    0
1 |   0  | 0 | 1 |    1
1 |   1  | 0 | 1 |    0

How do you find the distance between two nodes in a Binary Tree?

The distance between two nodes in a binary tree can be found by traversing the tree from the root to the lowest common ancestor (LCA) of the two nodes, and then summing the depths of the two nodes. The depth of a node is the number of edges from the root to the node.
Here’s a general algorithm to find the distance between two nodes in a binary tree:
  1. Start at the root of the tree.
  2. Traverse the tree, comparing the value of each node to the values of the two nodes you want to find.
  3. If the value of the current node is greater than both values, move to the left child. If the value of the current node is less than both values, move to the right child. If the value of the current node is between the two values, or equal to one of them, you have found the LCA.
    1. Calculate the depth of each node by counting the number of edges from the root to the node.
    2. Return the sum of the depths of the two nodes.
    Here’s an example of the algorithm in action:
Given the following binary tree:

Tree:
        20
       /  \
     10    30
    / \   /  \
   5  15 25   35

Suppose you want to find the distance between the nodes with values 15 and 35. The LCA of these nodes is 20, and the depths of the two nodes are 3 and 4, respectively. The distance between the nodes is 3 + 4 = 7.

Can you override a Constructor in java?

Constructor cannot be overridden because a constructor is not inherited from another class.

Implement Stack in C language.

#include <stdio.h>
#include <stdlib.h>
#define MAX 5
//Structure Declaration
typedef struct st_array{
    int a[MAX];
    int top;
}stack;

void push(stack *p,int n);
void pop(stack *p);
void display(stack* p);

int main(void) {
	int ch,val;
	stack s;
	s.top = -1;
	
	while(1){
	    printf("\n1.Push\n2.Pop\n3.Display\n4.Exit");
	    printf("\nEnter your choice");
	    scanf("%d",&ch);
	    
	    switch(ch){
	        case 1:printf("Enter the value");
	               scanf("%d",&val);
	               push(&s,val);
	               break;
	               
	        case 2:printf("Deleting the top");
	               pop(&s);
	               break;
	               
	       case 3:printf("Display");
	              display(&s);
	              break;
	              
	       case 4:exit(0);
	       default:printf("\nWrong Input");
	    }
	    
	}
	return 0;
}

void push(stack *p,int n){
    if(p->top == MAX-1){
        printf("Stack is full");
    }
    else{
        p->top++;
        p->a[p->top]=n;
        printf("Successfully Inserted");
    }
}

void pop(stack *p){
    int x;
    if(p->top == -1){
        printf("Stack is Empty");
    }
    else{
        x=p->a[p->top];
        p->top--;
        printf("%d is deleted",x);
    }
}

void display(stack *p){
    int i;
    if(p->top == -1){
        printf("Stack is empty");
    }
    else{
        for(i=p->top;i>=0;i--){
            printf("%d\t",p->a[i]);
        }
    }
}

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories