Multiple Choice Questions for Basics of C Language

  • 1 _____ header file is used for cin and cout statements.
    1. stdio.h
    2. iostream
    3. std
    4. conio.h

  • 2 _____ escape sequence cause a beep sound in specker.
    1. \b
    2. \a
    3. \s
    4. \r

  • 3 C/C++ language statements end with a ______.
    1. period
    2. comma
    3. semicolon
    4. nothing

  • 4 Which escape sequence is used to move the cursor on next line in output?
    1. \'
    2. \"
    3. \n
    4. \f

  • 5 Which of the following is/are not valid identifier(s) in C++?
    1. F_name
    2. Ph No
    3. &Up AnDdOwN
    4. Both b and c

  • 6 What is the output of the program: class A { public void main(String[] args){ System.out.println( "Hello c" + args[0] ); } }
    1. Hello c
    2. Runtime Error
    3. Hello 0
    4. None

  • 7 What is the output of this C code? int a =-1, b =4, c =1, d; d =++a &&++b ||++c; printf("%d, %d, %d, %d\n", a, b, c, d);
    1. 0, 4, 2, 1
    2. 0, 5, 2, 1
    3. -1, 4, 1, 1
    4. 0, 5, 1, 0

  • 8 Which of the following method are accepted for assignment?
    1. 5 = a = b = c = d;
    2. a = b = c = d = 5;
    3. a = b = 5 = c = d;
    4. None

  • 9 What will be the output of the program ? main() { char p[]=”%d\n”; p[1]=’c’; printf(p,65); }
    1. A
    2. a
    3. C
    4. 65

  • 10 What will print when this code is executed? main() { char *x=”HELLO”; x+=3; printf(“%s”,x); }
    1. HELLO
    2. ELLO
    3. LLO
    4. LO

Contact Us

support@subexpert.com
Write to Us View Help
Subject Expert Logo

Subject Expert

Learn and Evaluate

Follow Us
© 2020 - Subject Expert