VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/advanced-pointer-c-gq/

⇱ Quiz about C Advanced Pointer


Last Updated :
Discuss
Comments

Question 1

‘ptrdata’ is a pointer to a data type. The expression *ptrdata++ is evaluated as (in C++) :
 

  • Depends on compiler
     

  • (*ptrdata)++
     

  • *(ptrdata)++
     

  • *(ptrdata++)
     

Question 2

What is printed by the following C program?

  • 18

  • 19

  • 21

  • 22

Question 3

What will be output of the following program? Assume that you are running this program in little-endian processor.

  • 1

  • 320

  • 64

  • Compilation error

Question 4

Consider the following C function

The output of the program is

  • SI

  • IT

  • TI

  • 17

Question 5

Find out the correct statement for the following program.
  • Line with comment (1) will give compile error.
  • Line with comment (2) will give compile error.
  • Lines with (1) & (3) will give compile error.
  • Lines with (2) & (4) will give compile error.
  • No compile error and program will run without any issue.

Question 6

In the context of the below program snippet, pick the best answer.

Which of the given printf statement(s) would be able to print arr[5][5][5]

  • only (i) would compile and print 123.

  • both (i) and (ii) would compile and both would print 123.

  • only (i), (ii) and (iii) would compile but only (i) and (ii) would print 123.

  • only (i), (ii) and (iii) would compile and all three would print 123.

  • all (i), (ii), (iii) and (iv) would compile but only (i) and (ii) would print 123.

  • all (i), (ii), (iii) and (iv) would compile and all would print 123.

Question 7

Pick the best statement for the above C program snippet.

  • Assigning (void *)0 to pVoid isn’t correct because memory hasn’t been allocated. That’s why no compile error but it'll result in run time error.

  • Assigning (void *)0 to pVoid isn’t correct because a hard coded value (here zero i.e. 0) can’t assigned to any pointer. That’s why it'll result in compile error.

  • No compile issue and no run time issue. And the size of the void pointer i.e. pVoid would equal to size of int.

  • sizeof() operator isn’t defined for a pointer of void type.

Question 8

Choose the correct statement w.r.t. above C program.

  • malloc() for ppInt1 and ppInt2 isn’t correct. It’ll give compile time error.

  • free(*ppInt2) is not correct. It’ll give compile time error.

  • free(*ppInt2) is not correct. It’ll give run time error.

  • No issue with any of the malloc() and free() i.e. no compile/run time error.

Question 9

Consider the following C program.

The output of the program is _________

  • 140

  • 120

  • 100

  • 40

Question 10

What is the output of the following C code? Assume that the address of x is 2000 (in decimal) and an integer requires four bytes of memory.

  • 2036, 2036, 2036

  • 2012, 4, 2204

  • 2036, 10, 10

  • 2012, 4, 6

Tags:

There are 19 questions to complete.

Take a part in the ongoing discussion