c Gate Questions

Embed Size (px)

Citation preview

  • 8/13/2019 c Gate Questions

    1/12

    S.no Question

    1 Which of the following is invalid?

    2 The operator + in a+=4 means

    3 Which of the following is an example of compounded assignment statement?

    4 Which escape character can be used to beep from speaker in c ?

    5 The size of a String variable is

    6 The operator & is used for7 What will be the maximum size of a float variable?

    8 The operator / can be applied to

    9 The equality operator is represented by

    10 Which of the following operator has the highest precedence?

    11 1. #include

    void main()

    {

    int x = 97;

    char y = x;

    printf("%c\n", y);

    }

    12 The number of tokens in the following C statement.

    printf("i = %d, &i = %x", i, &i);

    13 Which of the following statements is incorrect ?

    14 If y is of integer type then the expression

    3 * ( y - 8 ) / 9 and ( y - 8 )/ 9 * 3

    15 What is (void*)0?

    16 In which header file is the NULL macro defined?

    17 What is the output of the following 'C' program?

    main()

    {

    int a[5]={2,3};

    printf("\n%d%d%d",a[2],a[3],a[4]);

    }

    18 Identify the invalid pointer arithmetic

    19 Consider the declaration:

    static struct { unsigned a:5;

    unsigned b:5;

    unsigned c:5;

    unsigned d:5%:

    }v=(1,2,3,4);

    v occupies

    20 If a structure is defined as

    struct TAB{

  • 8/13/2019 c Gate Questions

    2/12

    short a;

    int b;

    long c;

    }TABLE[10];

    the the total memory requirement for TABLE is

    21 The function fopen("filename","r")returns

    22 pick out the error in the program

    #include

    int main()

    {

    int a[] = {10, 20, 30, 40, 50};

    int j;

    for(j=0; j

  • 8/13/2019 c Gate Questions

    3/12

  • 8/13/2019 c Gate Questions

    4/12

    37 Array subscripts in C always start at

    38 Maximum number of elements in the array declaration

    int a[5][8] is

    39 Pointers are of

    40 A pointer to a pointer in a form of

    41 C allows arrays of greater than two dimensions,

    who will determined this

    42 When the main function is called, it is called with the

    arguments

    43 In C, a Union is

    44 The continue command cannot be used with

    45 A Link is

    46 The conversion characters for data input means that the data

    item is

    47 The printf() function retunes which value when an error occurs?

    48 Header files in C contain

    50 The type cast operator is

    51 Explicit type conversion is known as

    52 What will be the output of the expression 11 ^ 5?

    53

  • 8/13/2019 c Gate Questions

    5/12

    Option 1 Option 2 Option 3

    ' ' a

    a=a+4 a+4=a a=4

    a=5 a +=5 a=b=c

    \a \b \m

    1 byte 2 bytes 16 bytes

    Bitwise AND Bitwise OR Logical AND1 byte 2 bytes 4 bytes

    integer values float values double values

    := .EQ =

    * ==' =>'

    a b 97

    3 26 10

    C provides no input-output C provides no file access Provides no features to

    features features manipulate composite

    must yield the same must yield different may or may not yield

    value value the same value

    Representation representation error

    of NULL pointer of void pointer

    stdio.h stddef.h stdio.h and stddef.h

    Garbage values Error 3 2 2

    Addition of float value to comparison of pointers subtracting an integer

    a pointer that do not point to the from a pointer

    element of the same array

    4 bytes 2 bytes 1 byte

    14 140 40

  • 8/13/2019 c Gate Questions

    6/12

    Nothing A value 0 or 1 depending A pointer to FILE

    on whether the file filename,if it exitscould be opened or not

    Error: Declaration syntax Error:Expression syntax Lvalue required

    ink ack ite

    30 27 9

    integers File names Bytes

    goodbye odbye dbye

  • 8/13/2019 c Gate Questions

    7/12

    10 4 6

    Lower bound Upper bound Range

    Two Eight Twenty

    &x[i-1] + sizeof (int) x + sizeof (int) * i x+i

    2 2 2 1 0 1

    3 26 10

    Initialization is a part of It is a declaratrion It is a formal parameter

    definition

    1167 1164 1264

    Addition of float value to a Comparision of pointers subtracting an integer

    pointer that do not point to the from a pointer

    element of the same

    array

    can be read as a single cannot be read as a single can be displayed as a

  • 8/13/2019 c Gate Questions

    8/12

    entity entity single entity

    -1 1 0

    28 32 35

    interger data type character data type unsigned integerdata type

    multiple indirection a chain of pointers both a and b

    programmer compiler parameter

    argc argv None of these

    memory location memory store memory screen

    for switch do

    a compiler an active debugger a C interpreter

    An unsigned decimal A short integer A hexadecimal integer

    interger

    Positive value Zero Negative value

    Compiler commands Library funcitons Header information

    of C programs

    (type) cast() //'

    Casting conversion Disjunction

    5 6 11

  • 8/13/2019 c Gate Questions

    9/12

    Option 4 Correct Answer

    abc abc'

    a=4+4 a=a+4

    a=b a +=5

    \n \a

    none 2 bytes

    Logical OR Bitwise AND8 bytes 4 bytes

    All of these All of these

    ==' =='

    +'

    runtime error a

    21 10

    all of these all of these

    none of these may or may not yeld the

    same value

    none of these Representation

    of NULL pointer

    math.h stdio.h and stddef.h

    0 0 0 0 0 0

    assigning the value

    0 to a pointer variable assigning the value 0 to the pointer variable

    none of these 4 bytes

    32 140

  • 8/13/2019 c Gate Questions

    10/12

    A pointer to a new file A value 0 or 1 depending

    after creating it on whether the filecould be opened or not

    Rvalue required Lvalue required

    let ink

    3 30

    bits Bytes

    bye dbye

  • 8/13/2019 c Gate Questions

    11/12

  • 8/13/2019 c Gate Questions

    12/12

    that cannot be read

    individually

    value provided 0

    by user

    40

    none of these integer data type

    None of these both a & b

    None of these

    both a & b both a & b

    None of these memory store

    while switch

    an analyzing tool in C

    A string followed by

    while space

    None of these Negative value

    Operators for files Library functons

    " " (type)

    Seperation Casting

    None of these None of these