โ† All B CompE Bachelor of Computer Engineering Flashcard Decks

Bachelor of Computer Engineering C Language Flashcards

7 cards from real B CompE Bachelor of Computer Engineering practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Bachelor of Computer Engineering C Language flashcards as text
  1. What is the result of the expression `5 >> 1` in C?

    Answer: 2

    Right-shifting 5 (binary 101) by 1 position yields 2 (binary 010).

  2. Which storage class specifier in C limits a variable's visibility to the file in which it is declared?

    Answer: static

    A file-scope variable declared with `static` has internal linkage, making it invisible outside that translation unit.

  3. In C, what does the `volatile` qualifier tell the compiler?

    Answer: Do not cache the variable in a register; always read from memory

    `volatile` prevents the compiler from optimizing accesses, ensuring every read/write goes to actual memory.

  4. What is the output of: `printf("%d", sizeof('A'));` in a typical 32-bit C implementation?

    Answer: 4

    In C, character literals have type `int`, so `sizeof('A')` equals `sizeof(int)`, which is 4 on most 32-bit platforms.

  5. Which function is used to release memory allocated by `malloc`?

    Answer: free

    `free()` is the standard C library function to deallocate memory previously allocated by `malloc`, `calloc`, or `realloc`.

  6. What is a dangling pointer in C?

    Answer: A pointer that points to memory that has been freed or gone out of scope

    A dangling pointer references memory that is no longer valid, often because `free()` was called or the pointed-to local variable was destroyed.

  7. In C, which of the following correctly declares a pointer to a function that takes an `int` and returns `double`?

    Answer: double (*fp)(int);

    `double (*fp)(int);` declares `fp` as a pointer to a function with an `int` parameter returning `double`.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy