C-quiz, Hcst Mathura

56 Questions | Attempts: 151
Share

SettingsSettingsSettings
C-quiz, Hcst Mathura - Quiz

Hindustan College of Science and Technology Farah ,Mathura Organised By Department of CSE & IT.
A quiz is a form of game or mind sport, in which the players (as individuals or in teams) attempt to answer questions correctly. It is a game to test your knowledge about a certain subject. In some countries, a quiz is also a brief assessment used in education and similar fields to measure growth in knowledge, abilities, and/or skills.


Questions and Answers
  • 1. 

    C language has been developed by ?

    • A.

      Ken Thompson

    • B.

      Dennis Ritchie

    • C.

      Peter Norton

    • D.

      Martin Richards

    Correct Answer
    B. Dennis Ritchie
  • 2. 

    A C variable cannot start with ?

    • A.

      An alphabet

    • B.

      A number

    • C.

      A special symbol other than underscore

    • D.

      Both (2) and (3)

    Correct Answer
    D. Both (2) and (3)
  • 3. 

    What is the output of the following 'C' program? main ( ) { int a [5] = {2, 3}; print f (''\n % d % d % d'', a [2], a [3], a [4]); } 

    • A.

      Garbage values

    • B.

      2 3 3

    • C.

      3 2 2

    • D.

      0 0 0

    Correct Answer
    D. 0 0 0
  • 4. 

    What is the output of the following 'C' program? main { printf (''%c'', ''abcdefgh'' [4]);} 

    • A.

      Error

    • B.

      D

    • C.

      E

    • D.

      Abcdefgh

    Correct Answer
    C. E
  • 5. 

    The directives for the preprocessors begin with

    • A.

      Ampersand symbol (&)

    • B.

      Less than symbol (

    • C.

      Two Slashes (//)

    • D.

      Number Sign (#)

    Correct Answer
    D. Number Sign (#)
  • 6. 

    Point out the correct statements are correct about the program below? #include<stdio.h> int main() { char ch; while(x=0;x<=255;x++) printf("ASCII value of %d character %c\n", x, x); return 0; }

    • A.

      The code generates an infinite loop

    • B.

      The code prints all ASCII values and its characters

    • C.

      Error: x undeclared identifier

    • D.

      Error: while statement missing

    Correct Answer
    D. Error: while statement missing
  • 7. 

    Which of the following is the correct usage of conditional operators used in C?

    • A.

      A>b ? c=30 : c=40;

    • B.

      A>b ? c=30;

    • C.

      Max = a>b ? a>c?a:c:b>c?b:c

    • D.

      Return (a>b)?(a:b)

    Correct Answer
    C. Max = a>b ? a>c?a:c:b>c?b:c
  • 8. 

    What will be the output of the program? #include<stdio.h> #include<math.h> int main() { float n=1.54; printf("%f, %f\n", ceil(n), floor(n)); return 0; }

    • A.

      2.000000, 1.000000

    • B.

      1.500000, 1.500000

    • C.

      1.550000, 2.000000

    • D.

      1.000000, 2.000000

    Correct Answer
    A. 2.000000, 1.000000
  • 9. 

    What will be the output of the program? #include<stdio.h> int get(); int main() { const int x = get(); printf("%d", x); return 0; } int get() { return 20; }

    • A.

      Garbage value

    • B.

      20

    • C.

      Error

    • D.

      0

    Correct Answer
    B. 20
  • 10. 

    What function should be used to free the memory allocated by calloc() ?

    • A.

      Dealloc();

    • B.

      Malloc(variable_name, 0)

    • C.

      Free();

    • D.

      Memalloc(variable_name, 0)

    Correct Answer
    C. Free();
  • 11. 

    What do the following declaration signify? void *cmp();

    • A.

      Cmp is a pointer to an void type.

    • B.

      Cmp is a void type pointer variable.

    • C.

      Cmp is a function that return a void pointer.

    • D.

      Cmp function returns nothing.

    Correct Answer
    C. Cmp is a function that return a void pointer.
  • 12. 

    The library function used to find the last occurrence of a character in a string is

    • A.

      Strnstr()

    • B.

      Laststr()

    • C.

      Strrchr()

    • D.

      Strstr()

    Correct Answer
    C. Strrchr()
  • 13. 

    Character Set of C language contains ?

    • A.

      Alphabets

    • B.

      Digits

    • C.

      Special Symbols

    • D.

      All of these

    Correct Answer
    D. All of these
  • 14. 

    The format string %lf is used for ?

    • A.

      Float

    • B.

      Double

    • C.

      Unsigned int

    • D.

      Long double

    Correct Answer
    D. Long double
  • 15. 

    Which of the format string is not valid ?

    • A.

      %ld

    • B.

      %lf

    • C.

      %lu

    • D.

      %lc

    Correct Answer
    D. %lc
  • 16. 

    5.     When array name is passed to a function, what actually gets passed is

    • A.

      A. Address of array

    • B.

      B. First element of array

    • C.

      C. All array elements

    • D.

      D. None from the list

    Correct Answer
    A. A. Address of array
  • 17. 

    Which of the following statements is wrong ?

    • A.

      INT=123;

    • B.

      Val='A' * 'B';

    • C.

      Is=20 * 'T'

    • D.

      Count+5=res;

    Correct Answer
    D. Count+5=res;
  • 18. 

    C Programs cab be written in ... ?

    • A.

      Lower case letters

    • B.

      Upper case letters

    • C.

      Mixed letters

    • D.

      None of these

    Correct Answer
    A. Lower case letters
  • 19. 

    Which of these is not a version of C language ?

    • A.

      Microsoft C

    • B.

      Quick C

    • C.

      Turbo C

    • D.

      Fast C

    Correct Answer
    D. Fast C
  • 20. 

    C Programming Follows ....?

    • A.

      Non structured approach

    • B.

      Structured approach

    • C.

      Object oriented approach

    • D.

      None of these

    Correct Answer
    B. Structured approach
  • 21. 

    C Programs are converted into machine language with the helop of ..... ?

    • A.

      Compiler

    • B.

      Interpreter

    • C.

      Operating system

    • D.

      Assembler

    Correct Answer
    A. Compiler
  • 22. 

    C was primarily developed as a ?

    • A.

      Systems Programing Language

    • B.

      General Purpose Language

    • C.

      Data Processing Language

    • D.

      D. None of the above

    Correct Answer
    A. Systems Programing Language
  • 23. 

    What punctuation must use to end the code C/C++ expression statement?

    • A.

      . (dot)

    • B.

      ; (semi-colon)

    • C.

      : (colon)

    • D.

      ‘ (single quote)

    Correct Answer
    B. ; (semi-colon)
  • 24. 

    What symbol must use to signal the beginning and end of code blocks or compound statements?

    • A.

      { }

    • B.

      -> and

    • C.

      BEGIN and END

    • D.

      ( and )

    Correct Answer
    A. { }
  • 25. 

    Which one of the following is the correct operator to compare two variables?

    • A.

      : =

    • B.

      =

    • C.

      Equal

    • D.

      = =

    Correct Answer
    D. = =
  • 26. 

    “C” was primarily developed as a

    • A.

      Systems Programing Language

    • B.

      General Purpose Language

    • C.

      Data Processing Language

    • D.

      None

    Correct Answer
    A. Systems Programing Language
  • 27. 

    Choose the correct statement

    • A.

      An identifier may start with an underscore

    • B.

      An identifier may end with an underscore

    • C.

      IF is a valid identifier

    • D.

      All

    Correct Answer
    D. All
  • 28. 

    Choose the correct statement

    • A.

      Constant expressions are evaluated at compile time

    • B.

      String constants can be concatenated at compile time

    • C.

      Size of array must be known at compile time

    • D.

      All

    Correct Answer
    D. All
  • 29. 

    Which of the following comments about the “++” operator are correct?

    • A.

      It is a unary operator

    • B.

      It cannot be applied to an expression

    • C.

      It associates from the right

    • D.

      All

    Correct Answer
    D. All
  • 30. 

    What statement can print \n on screen?

    • A.

      Printf("\\n");

    • B.

      Printf("n\")

    • C.

      Printf('\\n')

    • D.

      Printf("\n")

    Correct Answer
    A. Printf("\\n");
  • 31. 

    Address stored in the pointer variable is of type?

    • A.

      Int

    • B.

      Float 

    • C.

      Array

    • D.

      String

    Correct Answer
    A. Int
  • 32. 

    What will be printed? int a = 15;  int b = 0;  b = (a % 7);    printf("\n\n%i\n", b);

    • A.

      0

    • B.

      1

    • C.

      7

    • D.

      15

    Correct Answer
    B. 1
  • 33. 

    The operators . , !! , < , = if arranged in ascending order of precedence reads?

    • A.

      .,!!,<,=

    • B.

      =,<,!!,.

    • C.

      =,!!,<,.

    • D.

      <,!!,=,.

    Correct Answer
    C. =,!!,<,.
  • 34. 

    Which one of the four equations will be correct? given interchanges: signs "-" and "*" ,numbers 3 and 6. 

    • A.

      6-3*2=9

    • B.

      6*3-4=15

    • C.

      3-6*8=10

    • D.

      3*6-4=33

    Correct Answer
    C. 3-6*8=10
  • 35. 

    According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments?

    • A.

      Int main(int argc,char *argv[])

    • B.

      Int main(){int argc ; char *argv);

    • C.

      None

    • D.

      Int main {argc,argv)int argc; char *argv;

    Correct Answer
    A. Int main(int argc,char *argv[])
  • 36. 

    Char *s[10] defines an array of ___________

    • A.

      None

    • B.

      String to pointer 

    • C.

      Pointers to strings

    • D.

      Both pointers to string and strings to pointers

    Correct Answer
    C. Pointers to strings
  • 37. 

    Which header file should be included to use functions like malloc() and calloc()?

    • A.

      Dos.h

    • B.

      Alloc.h

    • C.

      Stdlib.h

    • D.

      Memory.h

    Correct Answer
    C. Stdlib.h
  • 38. 

    What gets printed? printf("%d\n",4 ?:8);

    • A.

      8

    • B.

      4

    • C.

      Null

    • D.

      Compiler error

    Correct Answer
    D. Compiler error
  • 39. 

    Which keyword is used for coming out of recursion ?

    • A.

      Break 

    • B.

      Return

    • C.

      Exit

    • D.

      Continue

    Correct Answer
    B. Return
  • 40. 

    What is the output of the following 

    • A.

      Yes 

    • B.

      No

    • C.

      Compile time error

    • D.

      Yes no

    Correct Answer
    C. Compile time error
  • 41. 

    How many tokens are there in the following ?       if(csi==100);

    • A.

      6

    • B.

      7

    • C.

      5

    • D.

      4

    Correct Answer
    B. 7
  • 42. 

    C programming:the given expression P-=Q+1 is same as

    • A.

      P=P-Q-1

    • B.

      P=P-Q+1

    • C.

      P=-P+Q+1

    • D.

      NONE

    Correct Answer
    A. P=P-Q-1
  • 43. 

    A pointer in a c which has not been initialized is know as

    • A.

      Far pointer

    • B.

      Void pointer

    • C.

      Null pointer

    • D.

      Wild pointer

    Correct Answer
    D. Wild pointer
  • 44. 

    Which of the following does not represent a valid storage class in c?

    • A.

      Static

    • B.

      Union

    • C.

      Extern

    • D.

      Automatic

    Correct Answer
    B. Union
  • 45. 

    When fopen() is not able to open a file, then it returns

    • A.

      Compiler dependent

    • B.

      Runtime error

    • C.

      EOF

    • D.

      NULL

    Correct Answer
    A. Compiler dependent
  • 46. 

    How will you free the allocated memory ?

    • A.

      Delete(var-name);

    • B.

      Free(var-name);

    • C.

      Remove(var-name)

    • D.

      Dealloc(var-name);

    Correct Answer
    B. Free(var-name);
  • 47. 

    What will be x in the following c code? #include void main() {  int x; }

    • A.

      Automatic variable

    • B.

      Static variable

    • C.

      Registered variable

    • D.

      Global variable

    Correct Answer
    A. Automatic variable
  • 48. 

    Which of the following cannot be static in c?

    • A.

      Variables 

    • B.

      Structures

    • C.

      Functions

    • D.

      None

    Correct Answer
    D. None
  • 49. 

    What is the output of the following?   #include int main() {     char ch;     if(ch = printf(""))         printf("It matters\n");     else         printf("It doesn't matters\n");     return 0; }

    • A.

       It matters

    • B.

      It doesn’t matters

    • C.

       Run time error

    • D.

      Nothing

    Correct Answer
    B. It doesn’t matters
  • 50. 

    How many times is Hello world printed ?   int main() {     fork();     fork();     printf("Hello world\n"); }

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      8

    Correct Answer
    C. 4

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 07, 2019
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 03, 2019
    Quiz Created by
    Praveen
Back to Top Back to top
Advertisement