Programming Contest Questions

This is a discussion on Programming Contest Questions within the C++ Programming forums, part of the General Programming Boards category; I am going to a computer science contest tomorrow and would appreciate some help on a few problems that I ...

  1. #1
    Registered User dragunsflame's Avatar
    Join Date
    Jan 2003
    Posts
    8

    Question Programming Contest Questions

    I am going to a computer science contest tomorrow and would appreciate some help on a few problems that I can not figure out. Any explanations would be truly appreciated. (C++ is the language used)

    1) What is the result of the following expression:
    1 + 2 , 3 * 4 , 5 / 6 , 7 - 8
    A. 3
    B. 0
    C. -1
    D. 12
    E. 14

    2) What is the result of the following expression:
    4 << 3 << 2 << 1
    A. 256
    B. 4000000
    C. 512
    D. 1000000000
    E. undefined

    Also, could someone please explain these operators?
    | & ^

    Thanks in advance for your help!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,670
    I was born in Texas.....Yeeeeeee Haaaaaaaaw.

    1) Compile and print the expressions and see what you get
    2) Compile and print the expression and see what you get

    "|" is logical OR
    "&" is logical AND
    "^" is logical XOR

    gg

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    1 + 2 , 3 * 4 , 5 / 6 , 7 - 8

    That is just one expression, look up the comma operator in your C++ book or online to see how it works. The answer is pretty to easy see as most of the expression is useless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  2. Expression Evaluator Contest
    By Stack Overflow in forum Contests Board
    Replies: 20
    Last Post: 03-29-2005, 09:34 AM
  3. WANTED: Contest Master
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-23-2003, 09:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21