Coding Q's Flashcards

1
Q

Write a simple function that prints out all factors of a given number n.

A

1) for (int i = 1; i <= n; i++) { if (n % i == 0) then print out i }

2) #include int main() { using namespace std; try { int product = 0; cout > product; for (int i = 1; i <= product; i++) { if (product % i == 0) { cout << i << “ is a factor of “ << product << endl; } } } catch (exception &ex) { cout << ex.what() << “ in main.” << endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Pointer arithmetic question: given a small table of addresses and their values, what are the values of 1) *p, 2) *(p++) and 3) *(p+3) ?

A

1) int temp[] = {0, 1, 2, 3, 4, 5}; int* p; p = temp; cout << *p << endl; // 0 cout << *(p++) << endl; // 0, since the value won’t increase until after it is assessed cout << *(p + 3) << endl; //4

2) Remember to check if the three values asked for are sequential or not (aka if incrementing p once will affect the value of p+3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

(NOT NSA)

Q1. Tell me about yourself

Q2. Code for printing Linked List in reverse.

Q3. Algorithm used for the Coding question.

Q4. What are the kind of sorting techniques.

Q5. Asked how does Quick sort and Merge sort works

Q6. What kind of sorting technique does the sort function of C++ STL use

Q7. Puzzle

Q8. Projects explanation

Q9. Questions from inside the projects

Q10. Responsibilities that I can carry out there. They gave some choices and asked which responsibility do you want to carry out.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

First, they asked, “Tell me something about yourself?”.

Then they started with the resume questioning.

They asked thoroughly about my projects. I had done one related to NLP, so they asked me about machine learning and NLP and basic definition questions like confusion matrix, precision-recall, 3 types of machine learning, etc.

Then they asked me one really simple programming question related to strings which goes like given a string like “This/t/t is a /t/t/t/t sentence/t/t/t” convert all the “/t” sequences to a single “/t”. I solved it obviously. But it was my first ever interview and I wasn’t aware that you are supposed to think out loud. So I just kept typing without speaking and the interviewers got bored.

Then there was an SQL query. You had 2 tables and one simple query which could be done by joining the 2 tables. I did not think out loud in this one too so again they were not impressed I suppose.

Then they asked me a puzzle, which is cutting a cake 3 times to get 8 equal pieces, which I wasn’t aware of, so I couldn’t do it.

Lastly, they asked questions about the company like what do you know about AMEX, some questions about their charge card. And that’s that.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

(NSA SPECIFIC)

Given an array
Sum the array
divide 2 if it is even without using division operator or library, multiply 2 without using multiplication operator or library

A

Input : a = 10, b = 3
Output : 3

Input : a = 43, b = -8
Output : -5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Given x86 assembly code
name the standard library C code

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Given memory address table
table is like an array
n = [4,5,6,7,8]

int p = &n
int **pp = &n

print(p)
print((p++))
print(*(pp))

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Tell me your experience with kernel mode, user mode

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Tell me your experience with radio frequency and using wavelength

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

You are working with a network, you gain access to root, how do you hack this machine

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

tell me your experience with rerverse engineer, tell me what tool did you use, what did you do

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write a simple function that prints out all factors of a given number n.

A

1)

Python:

for (int i = 1; i <= n; i++) { if (n % i == 0) then print out i }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Syntax and coding errors: Simple function in C with some errors.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pointer arithmetic question: given a small table of addresses and their values, what are the values of
1) *p,
2) *(p++) and
3) *(p+3) ?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly