Preview

Interview Question on C Language

Good Essays
Open Document
Open Document
1011 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Interview Question on C Language
(1) What is meaning of following declaration? int(*ptr[5])(); (a)ptr is pointer to function. (b)ptr is array of pointer to function (c)ptr is pointer to such function which return type is array. (d)ptr is pointer to array of function. (e)None of these Ans: (b) Explanation: Here ptr is array not pointer. (2) What is meaning of following pointer declaration? int(*(*ptr1)())[2]; (a)ptr is pointer to function. (b)ptr is array of pointer to function (c)ptr is pointer to such function which return type is pointer to an array. (d)ptr is pointer array of function. (e)None of these Answer: (c) Exp: (3)What is size of generic pointer in c? (a)0 (b)1 (c)2 (d)Null (e)Undefined Ans: (c) Size of any type of pointer is 2 byte (In case of near pointer) Note. By default all pointers are near pointer if default memory model is small. (4)

What will be output of following c code? #include int main(){ int *p1,**p2; double *q1,**q2; clrscr(); printf("%d %d ",sizeof(p1),sizeof(p2)); printf("%d %d",sizeof(q1),sizeof(q2)); getch(); return 0; } (a)1 2 4 8 (b)2 4 4 8 (c)2 4 2 4 (d)2 2 2 2 (e)2 2 4 4 Answer: (d) Exp: Size of any type of pointer is 2 byte (In case of near pointer) (5) What will be output if you will compile and execute the following c code? #include int main(){ char huge *p=(char *)0XC0563331; char huge *q=(char *)0XC2551341; if(p==q) printf("Equal"); else if(p>q) printf("Greater than"); else printf("Less than"); return 0; }

(a)Equal (b)Greater than (c)Less than (d)Compiler error (e)None of above Output: (a) Explanation: As we know huge pointers compare its physical address. Physical address of huge pointer p Huge address: 0XC0563331 Offset address: 0x3331 Segment address: 0XC056 Physical address= Segment address * 0X10 + Offset address =0XC056 * 0X10 +0X3331 =0XC0560 + 0X3331 =0XC3891 Physical address of huge pointer q Huge address: 0XC2551341 Offset address: 0x1341 Segment address: 0XC255 Physical address= Segment address * 0X10 + Offset address =0XC255 * 0X10

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Nt1310 Unit 3

    • 659 Words
    • 3 Pages

    Program description: I calculated the usable area in square feet of a house. Assume that the house has a maximum of four rooms, and that each room is rectangular. I wrote pseudo code statements to declare 4 Integers and labeled them homesqft, room1, room2, room3, and room4. Each room will have its length and width to calculate its area.…

    • 659 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 1 Quiz

    • 1980 Words
    • 8 Pages

    6 . For an unconditional approach to a particular part of a complex PL/SQL block, which of the following control structures can be used?…

    • 1980 Words
    • 8 Pages
    Good Essays
  • Better Essays

    Nt1310 Unit 4

    • 3614 Words
    • 15 Pages

    The program is trying to collect the value of a "void" function into an integer variable.…

    • 3614 Words
    • 15 Pages
    Better Essays
  • Satisfactory Essays

    CHAPTER3 REVEIW

    • 527 Words
    • 3 Pages

    a. The CPU tells the RAM which address holds the data that the CPU wants to read…

    • 527 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Class C: The first and second bits in the first octet become 1s. The third bit must remain a 0. The remaining five bits can be a 1, giving a maximum total of 223. Class C first octet range is 192 through 223.…

    • 2698 Words
    • 9 Pages
    Powerful Essays
  • Satisfactory Essays

    c) There was no overflow condition because the numbers have opposite signs and overflow cannot occur.…

    • 1112 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Structured Query Language (SQL) is a standard database computer language used for querying, modifying and managing data in Relational Database Management Systems (RDBMS). SQL was developed in the 1970's by IBM to initially manipulate and retrieve data in IBM System R. The SQL language was standardized in 1986 by the American National Standards Institute (ANSI); however, later releases were released as International Organization for Standardization (ISO) standards.…

    • 612 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    This chapter describes the concepts behind how a CPU reads the contents from RAM. Which of the following is true about the process of read data, as described in the chapter?…

    • 605 Words
    • 3 Pages
    Good Essays
  • Good Essays

    chapter 1.1 review

    • 368 Words
    • 2 Pages

    4). The first attempt at breaking up IP address space used 4 bytes to provide address ranges of different sizes.…

    • 368 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Unit 6 Assignment 2 Choosing the right programming language. (P2) There are several factors to consider when choosing the right programming language, these include Organisational policy, suitability in terms of available features and tools, availability of trained staff and development and maintenance costs. Organisational policy Organisations which make and develop loads of computer software’s and programs tend to have a policy of using a certain language, a reason for this might be because that language allows them to make all their software consistent and easier to maintain.…

    • 1542 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    E4.10: Draw the stack frame and enter the value of each stack slot (if it is…

    • 900 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    a) This code is horrible because it returns the memory address of a local variable…

    • 775 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Programming Homework

    • 366 Words
    • 2 Pages

    Write a program that would calculate and display the results for the multiplication table for values ranging from 1 to 100.…

    • 366 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    It 218 Week 4 Checkpoint

    • 290 Words
    • 2 Pages

    A pointer can be defined as a memory address. To further explain this definition, we declared a variable of (name). It will look much like this (int name). Every variable will occupy some memory. Now we will declare another variable to under (int name). This variable will be (int name-1), and now this variable is declared as a pointer to (int name).What makes it a pointer is the fact that (name-1) points towards (int name) in a memory storage sense. Basically the pointer to (int name) is the contents of (int name-1). In simple terms, the pointer is not a variable at all. It is the place a specific variable will store and access its information.…

    • 290 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    I captured the sight of the sun rising through my blurred safety glass window, must be morning. Awakening in the same claustrophobic battle scarred room has been my life for 3 years now. Getting to my feet I peer through the withered cast iron bars of my cell to see the guards carrying out the routine cell checks. This time something was different. I see a guard broadcasting to a fellow officer for assistance a small number of cells down from me. I feel a cold shiver ran down my back. This occurs far too often for me to not realise what is happening. About 30 seconds has gone and every inmate in C block is gazing at the phenomenon. A rush of Correctional Officers burst into the open box. I catch a glimpse of one holding a black plastic zip…

    • 413 Words
    • 2 Pages
    Good Essays