Placement Prep

10 Technical Interview Aptitude Questions: Part 2 (Solved)

Solved set 2: C programming on static variables, pointer arithmetic, bitwise XOR, sizeof, and const, plus quantitative aptitude and logical reasoning.

By FACE Prep Team 8 min read
technical-interview aptitude c-programming placement-prep campus-placement quantitative-aptitude logical-reasoning

Part 2 of the FACE Prep technical aptitude series covers 10 new questions: five on C programming fundamentals, three on quantitative reasoning, and two on logical deduction.

None of the questions here duplicate Part 1, which covered pre-increment vs post-increment, the null terminator, invalid relational operators, int overflow on 16-bit systems, and number series patterns. If you have not worked through that set, start there. The two sets together cover the topic range that repeats most consistently across technical rounds at IT services and mid-tier product companies.

How This Set Compares to Part 1

Part 1 focused on the most frequently asked beginner-to-intermediate C concepts: operators that beginners confuse, string handling, and integer range edge cases. This set steps up one level.

AreaPart 1 topicsPart 2 topics
C fundamentalsIncrement operators, assignment vs equality, relational operators, int overflowStatic variables, pointer arithmetic, sizeof, bitwise XOR, const qualifier
Quantitative aptitudeNumber series, speed-distance-time, coding-decodingPermutations, mixture ratios, simple interest
ReasoningStack vs queue, nested loop outputBlood relations, letter analogy

The format within each set is consistent: five C or CS questions, three aptitude questions, two reasoning questions. Use the same approach for both parts: attempt each question under a 2-minute time cap before reading the worked answer.

Five C Programming Fundamentals Questions

Q1: Static variables in C

A function is called three times. Inside the function, the code reads static int count = 0; count++;. What is the value of count printed after each call?

  • Answer: 1 after the first call, 2 after the second, 3 after the third.
  • Why: A static local variable is initialized only once. On the first call, count starts at 0 and increments to 1. The variable is not destroyed when the function returns. On the second call, initialization is skipped and count increments from 1 to 2. Third call: 2 to 3.
  • Contrast: A regular int count = 0 re-initializes to 0 on every call. That version would print 1, 1, 1.
  • Where it appears: Output-prediction questions at TCS, Infosys, and Wipro technical rounds. The correct answer depends entirely on recognizing the static keyword.

Q2: Pointer arithmetic

int arr[] = {10, 20, 30, 40, 50};
int *p = arr;
printf("%d", *(p+2));

What does this print?

  • Answer: 30.
  • Step 1: p is assigned the address of arr[0], which holds the value 10.
  • Step 2: p+2 moves the pointer forward by 2 integer positions. On a 32-bit system where int occupies 4 bytes, p+2 points to the address of arr[2].
  • Step 3: *(p+2) dereferences that address. arr[2] contains 30.
  • Key rule: Pointer arithmetic scales by the size of the element type. Adding 2 to an int* moves 8 bytes forward (2 × 4 bytes), not 2 bytes. Reference: C pointer arithmetic — cppreference.com.

Q3: The sizeof operator

What does sizeof("FACE") return in C?

  • Answer: 5.
  • Why: The string literal "FACE" has 4 visible characters (F, A, C, E) plus the null terminator \0 appended automatically by the compiler. sizeof on a string literal returns the total bytes including \0.
  • Contrast with strlen: strlen("FACE") returns 4, because strlen counts characters up to but not including \0.
  • Exam trap: Questions asking for sizeof versus strlen on the same string are a placement paper staple. sizeof gives n+1; strlen gives n.

Q4: Bitwise XOR

What is the result of 7 ^ 3 in C?

  • Answer: 4.
  • Step 1: Write both numbers in binary. 7 = 0111. 3 = 0011.
  • Step 2: Apply XOR column by column. XOR produces 1 when the bits differ, 0 when they match.
    • Bit 3: 0 XOR 0 = 0
    • Bit 2: 1 XOR 0 = 1
    • Bit 1: 1 XOR 1 = 0
    • Bit 0: 1 XOR 1 = 0
  • Step 3: Result is 0100 in binary = 4 in decimal.
  • Why it appears in interviews: XOR drives the classic single-non-repeated-element algorithm (XOR all array elements; the result is the lone unpaired value). Knowing the bit-level mechanics is a prerequisite. Reference: C bitwise operators — cppreference.com.

Q5: The const qualifier

Consider this code:

const int x = 5;
x = 10;

Does this compile? What happens?

  • Answer: No. The compiler raises an error: assignment of read-only variable.
  • Why: The const qualifier tells the compiler that x may not be modified after its initial declaration. Any subsequent assignment to x is a compile-time rejection.
  • Contrast with runtime errors: This is not a segmentation fault or undefined behavior. It is caught at compile time. The program never runs.
  • Where it appears: const questions test whether a candidate distinguishes compile-time errors from runtime errors, a distinction that matters in output-prediction and code-review questions.

Three Quantitative Aptitude Questions

Q6: Permutations of distinct letters

In how many ways can the letters of the word PLACE be arranged?

  • Answer: 120.
  • Step 1: Count the distinct letters. P, L, A, C, E — five letters, all different.
  • Step 2: Apply the permutation formula for n distinct items arranged in all positions: n factorial.
  • Step 3: 5 factorial = 5 × 4 × 3 × 2 × 1 = 120.
  • Verify: First position can be filled 5 ways, second 4, third 3, second-last 2, last 1. Product = 120. Confirmed.
  • Common trap: If the word had a repeated letter (such as LEVEL, with two Ls and two Es), divide by the factorial of each repeated-letter count. LEVEL: 5 factorial divided by (2 factorial × 2 factorial) = 120 divided by 4 = 30.

For practice sets on coding-decoding and pattern-based reasoning, types of coding and decoding questions in aptitude tests covers every category with worked examples.

Q7: Mixture and ratio

A 40-litre container holds milk and water in the ratio 3:2. How many litres of water does it contain?

  • Answer: 16 litres.
  • Step 1: Total ratio parts = 3 + 2 = 5.
  • Step 2: Water occupies 2 parts out of 5 total.
  • Step 3: Water = (2 divided by 5) × 40 = 16 litres.
  • Verify: Milk = (3 divided by 5) × 40 = 24 litres. 24 + 16 = 40. Total checks out.
  • Variation to expect: The interviewer may ask how much water to add to reach a 1:1 ratio. Current state: milk = 24, water = 16. Target: equal volumes. Add 8 litres of water to reach 24:24.

Q8: Simple interest

  • Question: Find the simple interest on a principal of ₹8,000 at an annual rate of 12% per annum for 3 years.
  • Answer: ₹2,880.
  • Formula: SI = (P × R × T) divided by 100, where P = principal, R = annual rate, T = years.
  • Step 1: SI = (8000 × 12 × 3) divided by 100.
  • Step 2: 8000 × 12 = 96,000. 96,000 × 3 = 2,88,000. 2,88,000 divided by 100 = 2,880.
  • Result: Total amount after 3 years = ₹8,000 + ₹2,880 = ₹10,880.
  • Contrast with compound interest: Simple interest applies the rate to the original principal each period. Compound interest applies it to the growing balance. For the same inputs, compound interest always yields more after the first year.

For calendar-based quantitative problems that appear in the same aptitude rounds, calendar problems in aptitude tests covers the day-finding shortcuts used in campus drives.

Two Logical Reasoning Questions

Q9: Blood relations

Priya says, “Ravi’s mother is the only daughter of my father.” What is Priya’s relation to Ravi?

  • Answer: Priya is Ravi’s mother.
  • Step 1: “My father” refers to Priya’s father.
  • Step 2: “The only daughter of my father” — if there is only one daughter, that person is Priya herself.
  • Step 3: Substituting: “Ravi’s mother is Priya.”
  • Result: Priya is Ravi’s mother.
  • Why this type appears: Blood-relation questions test the ability to map a chain of relationships in working memory without losing track of the reference point. They are a standard component of the verbal reasoning section in AMCAT, CoCubes, and company-specific aptitude rounds.

Q10: Letter analogy

Keyboard is to typing as camera is to what?

  • Answer: Photography.
  • Relationship: A keyboard is the primary instrument used to perform the act of typing. A camera is the primary instrument used to perform the act of photography.
  • How to approach: Identify the relationship between the first pair (instrument : act it performs). Apply that same structure to the second pair.
  • Common trap: If the options include both “pictures” and “photography,” choose “photography” because it names the act, parallel to “typing,” not the product (which would be parallel to “typed text,” not “typing”).
  • Where it appears: Analogy questions appear in the verbal reasoning section of AMCAT, CoCubes, and eLitmus assessments. The structure is consistent: the first pair defines the relationship type; the second pair tests whether you can apply it.

For more practice on C output prediction, array indexing, and string manipulation patterns, C coding questions set 1 complements the pointer and operator topics covered above.

Building Accuracy with a Mixed Practice Routine

A solved set is a diagnostic, not a preparation plan. The goal is to surface which question types you cannot complete within 2 minutes, classify why, and address the gap before attempting the next set.

Three-step process that applies across both parts of this series:

  1. Attempt without reference. Do not read the worked answer until you have committed to an answer. Even a confident wrong answer is more useful than a skip, because it reveals exactly which step in your thinking breaks down.
  2. Classify the error type. For each wrong answer, decide: concept gap (the rule was unknown), process gap (the rule was known but misapplied), or calculation slip (the process was correct but the arithmetic went wrong). Each type requires a different response.
  3. Target the concept gap directly. A concept gap in static variables gets fixed by writing a 10-line program that calls a function 5 times and watching the counter increment. A calculation gap in simple interest gets fixed by drilling the formula on 5 fresh number sets. Re-reading the explanation alone is not sufficient for concept gaps.

The split that works for most students in the 4 to 6 weeks before a campus drive: 3 sessions per week on C and CS fundamentals, 2 sessions on quantitative aptitude, 1 session on reasoning and verbal. Adjust the ratio based on which error category appears most often in your practice logs, not based on which subject feels most comfortable to study.


The column-by-column bit reduction in Q4 (7 ^ 3 = 4) requires the same structured decomposition as writing an effective prompt for a language model: break the problem into its smallest components, apply one rule per step, and verify each output before moving to the next. TinkerLLM is ₹299 to try. The same methodical reasoning that cracks a bitwise XOR question maps directly to getting consistent outputs from an LLM on the first attempt, rather than hoping the model infers what you meant.

Primary sources

Frequently asked questions

What is a static variable in C and how does it differ from a regular local variable?

A static local variable in C is initialized only once, the first time the function is called, and retains its value between subsequent calls. A regular local variable is re-initialized each time the function executes. Both are local in scope — neither can be accessed from outside the function — but only the static one persists its value across calls.

How does pointer arithmetic work in C?

Adding an integer n to a pointer p moves the pointer forward by n elements of the pointed-to type, not by n bytes. If p is an int* and int occupies 4 bytes, then p+1 points to the next integer 4 bytes ahead. Dereferencing p+2 with *(p+2) gives the value stored two elements ahead of where p currently points.

What is bitwise XOR and when does it appear in placement interviews?

Bitwise XOR (the ^ operator in C) compares two numbers bit by bit. For each bit position, the result is 1 if the bits differ and 0 if they are the same. A common placement question: what is 7 ^ 3? Answer is 4, because 0111 XOR 0011 = 0100. XOR also appears in the classic find-the-single-non-repeated-element algorithm.

How do I calculate the number of arrangements of distinct letters in a word?

For a word with n distinct letters, the total number of arrangements is n factorial. For 5 distinct letters like PLACE, the answer is 5 factorial = 5 × 4 × 3 × 2 × 1 = 120. If the word has repeated letters, divide by the factorial of each repeated letter count: for NOON (two Ns, two Os), the count is 4 factorial divided by (2 factorial × 2 factorial) = 24 divided by 4 = 6.

How do I solve mixture and ratio problems in placement aptitude tests?

Find the total number of parts by adding the ratio values. Then calculate each component as (ratio part divided by total parts) multiplied by total volume. For a 40-litre mixture in ratio 3:2 (milk to water), total parts = 5, water = (2 divided by 5) × 40 = 16 litres. Always verify: milk plus water must equal the total volume.

What is the difference between a logical operator and a bitwise operator in C?

Logical operators (&&, ||, !) work on boolean truths: they evaluate whether the entire expression is true or false, and && short-circuits if the result is determined by the first operand. Bitwise operators (&, |, ^, ~) work on individual bits of both operands. The && operator may skip evaluating the right side; the & operator always evaluates both. This distinction appears in output-prediction questions in placement technical papers.

Build AI projects

A self-paced playground for building with LLMs.

TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.

Try TinkerLLM (₹299 launch)
Free AI Roadmap PDF