Code Challenge @ 2k19

59 Questions | Total Attempts: 148

SettingsSettingsSettings
Programming Quizzes & Trivia

.


Questions and Answers
  • 1. 
    Python code for print Asterisk (Start) pattern Program to print start pattern: Enter max star to be display on single line 4 * * * * * * * * * * * * * * * *
  • 2. 
    3.Program to check whether the input year is leap or not..
  • 3. 
    Write C Program to reverse given number:
  • 4. 
     What will be the output of the following C code? #include <stdio.h> int main() { void foo(); printf("1 "); foo(); } void foo() { printf("2 "); }
    • A. 

      1 2

    • B. 

      Compile time error

    • C. 

      1 2 1 2 

    • D. 

      Depends on the compiler

  • 5. 
    Which of the following are themselves a collection of different data types?
    • A. 

      String

    • B. 

      Structures

    • C. 

      Char

    • D. 

      All of the mentioned

  • 6. 
    Which of the following cannot be a structure member?
    • A. 

      Another structure

    • B. 

      Function

    • C. 

      Array

    • D. 

      None of the mentioned

  • 7. 
    Which variable has the longest scope in the following C code? #include <stdio.h> int b; int main() { int c; return0; } int a;
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      Both a and b

  • 8. 
    Which function will you choose to join two words?
    • A. 

      Strcpy()

    • B. 

      Strcat()

    • C. 

      Strncon()

    • D. 

      Memcon()

  • 9. 
    Which of the following is called address operator?
    • A. 

      *

    • B. 

      &

    • C. 

      _

    • D. 

      %

  • 10. 
    Which of the following is the scope resolution operator?
    • A. 

      .

    • B. 

      ::

    • C. 

      &&

    • D. 

      ~

  • 11. 
    Which of the following is accessed by a member function of a class?
    • A. 

      The object of that class

    • B. 

      All members of a class

    • C. 

      The public part of a class

    • D. 

      The private part of a class

  • 12. 
    What is the output of this program? #include <iostream> usingnamespacestd; int main() { int a; a =5+3*5; cout<< a; return0; }
    • A. 

      35

    • B. 

      20

    • C. 

      25

    • D. 

      30

  • 13. 
    What is the output of this program? #include <iostream> usingnamespacestd; int main() { int a =5, b =6, c, d; c = a, b; d =(a, b); cout<< c <<' '<< d; return0; }
    • A. 

      5 6

    • B. 

      6 5  

    • C. 

      6 7

    • D. 

      None of the mentioned

  • 14. 
    Modulus operator, %, can be applied to which of these?
    • A. 

      Integers

    • B. 

      Floating – point numbers

    • C. 

      Both Integers and floating – point numbers

    • D. 

      None of the mentioned

  • 15. 
     With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? x++; x= x +1; x+=1; x=+1;
    • A. 

      1, 2 & 3

    • B. 

      1 & 4

    • C. 

      1, 2, 3 & 4

    • D. 

      3 & 2

  • 16. 
     What is the output of this program? class increment { publicstaticvoid main(Stringargs[]) { double var1 =1+5; double var2 = var1 /4; int var3 =1+5; int var4 = var3 /4; System.out.print(var2 +" "+ var4); } }
    • A. 

      1 1

    • B. 

      0 1

    • C. 

      1.5 1

    • D. 

      1.5 1.0

  • 17. 
     What is the output of this program? class increment { public static void main(Stringargs[]) { int g =3; System.out.print(++g *8); } }
    • A. 

      25

    • B. 

      24

    • C. 

      32

    • D. 

      33

  • 18. 
    What is the output of this program? class Output { public static void main(Stringargs[]) { int a =1; int b =2; int c; int d; c =++b; d = a++; c++; b++; ++a; System.out.println(a +" "+ b +" "+ c); } }
    • A. 

      3 2 4

    • B. 

      3 2 3 

    • C. 

      2 3 4

    • D. 

      3 4 4 

  • 19. 
    What is the output of this program? class Output { public static void main(Stringargs[]) { int a,b,c,d; a=b=c=d=20 a+=b-=c*=d/=20 System.out.println(a+" "+b+" "+c+" "+d); } }
    • A. 

      Compile time error

    • B. 

      Runtime error

    • C. 

      A=20 b=0 c=20 d=1

    • D. 

      None of the mentioned

  • 20. 
    What is the output of the following? i = 5 while True: if i%0O9 == 0: break print(i) i += 1
    • A. 

      5 6 7 8

    • B. 

      5 6 7 8 9

    • C. 

      5 6 7 8 9 10 11 12 13 14 15 ....

    • D. 

      Error

  • 21. 
    What is the output of below program?  def writer():  title = 'Sir'  name = (lambda x:title + ' ' + x) 4. return name 5. 6. who = writer() 7. who('Arthur')
    • A. 

      Arthur Sir

    • B. 

      Sir Arthur

    • C. 

      Arthur

    • D. 

      None of the mentioned

  • 22. 
    What is the output of the following? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)
    • A. 

      0 1 2

    • B. 

      Error

    • C. 

      0 1 2 0 1 2

    • D. 

      None of the mentioned

  • 23. 
    Which of the following cannot be a variable in Python ?
    • A. 

      __init__

    • B. 

      In

    • C. 

      It

    • D. 

      On

  • 24. 
    ________ matches the start of the string. ________ matches the end of the string.
    • A. 

      ‘^’, ‘$’

    • B. 

      ‘$’, ‘^’

    • C. 

      ‘$’, ‘?’

    • D. 

      ‘?’, ‘^’

  • 25. 
    How many unique colors will be required for proper vertex coloring of an empty graph having n vertices?
    • A. 

      0

    • B. 

      1

    • C. 

      2

    • D. 

      N

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.