3i Infotech Placement: Sample Questions 450 - 452 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 450

Question

MCQ▾

Memory allocation of variables declared in a program is

Choices

Choice (4)

a.

allocated in RAM.

b.

allocated in ROM.

c.

assigned to registers.

d.

allocated on stack.

Answer

d.

Explanation

Memory Allocation
  • Variables declared in a program are allocated on the stack.
  • In a stack data is added or removed in a last in first out manner.
  • If a region of memory lies on the thread՚s stack, that memory is said to have been allocated on the stack.
  • Stack-based memory allocation is very simple and typically faster than heap-based memory allocation.
  • Memory on heap is allocated dynamically by the program.
  • Stack based allocation is suitable for temporary data or data which is no longer required after the creating function exits.

Question 451

Edit

Write in Short

Short Answer▾

Predict the output or error (s) for the following:

  1. main ()
  2. {
  3.     chara[4] =“HELLO”;
  4.     printf ( “%s”, a);
  5. }

Explanation

  • In this program
Table Showing the Program
char a [4] = “HELLO” ;
  • The character array a is of size 4 but the string constant requires 6 bytes to get stored.
  • So the compiler errors are accured.

Question 452

Edit

Write in Short

Short Answer▾

What is an incomplete type?

Explanation

  • Incomplete types refers to pointers non-available to be used in the implementation or they points to some location whose value is not available for modification. Example: int ⚹ i = 0x400 // i points to address 400 ⚹ i = 0; //set the value of memory location pointed by i.
  • Incomplete types are otherwise called uninitialized pointers.
Define the Incomplete Type Means Uninitialized Pointer

Developed by: