Building a test - Basic C#
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14

Thread: Building a test - Basic C#

  1. #1
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Question Building a test - Basic C#

    I could do this on my own, but I thought I'd throw this to you guys to help out. I'm trying to do this fast (next 24-48 hours) as I want to test a new content type we are launching here on CodeGuru. What I need is a test. This first test is to test a person's knowledge on C#.

    Let's keep this to BASIC knowledge, so a very intro level quiz as a start. I'd like to come up with about 10 questions that have multiple choice answers.

    If you want to suggest a question, post it to this thread along with possible answers. The next post will be an example from me to get things rolling.

    Again -- This is a BEGINNING / BASIC test. We can follow this with tests on specific topic areas as well as more advanced tests. If someone scores perfect on this test, we can say they know what C# is....

    Thanks for your input!

    Brad!
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  2. #2
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    Proposed question (#1):

    What is C#?

    (1) A proprietary language created by Microsoft used on the Windows platform

    (2) A proprietary language created by Microsoft that while primarily used on Windows can also be use don Linux and other platforms

    (3) A language created by Microsoft and standardized by ECMA as an open standard.

    (4) A derivative of Java for the Microsoft Windows Platform

    (5) A language created by Microsoft that is used to create native applications on versions of Windows starting with Windows Vista.
    Last edited by Brad Jones; March 12th, 2013 at 11:11 AM.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  3. #3
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    Proposed Question (#2)

    Understanding the execution of a C# program is important. Which is true about the execution of C# programs?

    (1) C# programs are generally compiled to native code, which is then installed on the target platform.

    (2) C# programs are compiled to an intermediary language that is then executed on a common language runtime.

    (3) C# programs are not compiled, but rather are interpreted at runtime.

    (4) C# program contains everything it needs to run on all Windows machines

    (5) None of the above are true.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  4. #4
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    Proposed Question (#3)

    Which of the following is a valid "Hello world" program in C#?

    (1) Example 1:
    Code:
    class Hello
    {
       void Main()
       {
           System.Console.WriteLine("Hello world");
       }
    }
    (2) Example 2:
    Code:
    program HelloWorld;
    
    begin
      writeln('Hello World');
    end.
    (3) Example 3:
    Code:
    class Hello
    {
       public static void Main()
       {
           System.Console.WriteLine("Hello world");
       }
    }
    (4) Example 4:
    Code:
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    }
    (5) Example 5:
    Code:
    Public Module modmain
       Sub Main()
         Console.WriteLine ("Hello World using Visual Basic!")
       End Sub
    End Module
    Last edited by Brad Jones; March 12th, 2013 at 11:09 AM.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  5. #5
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,201

    Re: Building a test - Basic C#

    Questions look fine. Minor nit - Hello World should include an exclamation point in the text.

    Code:
    System.Console.WriteLine("Hello world!");

  6. #6
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    It' s not an exciting day, so no exclamation point in my sample.....

    Okay Arjay - you are a king of coding, so I'd expect you to be able to crank out a few simple questions for me to use as well....

    please
    Last edited by Brad Jones; March 12th, 2013 at 12:41 PM.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  7. #7
    Join Date
    Jan 2010
    Posts
    1,099

    Re: Building a test - Basic C#

    Is this an ad hoc set of questions for evaluating the new functionality, or is this going to be actual content?
    IMO, you should ditch the first question, as it's not all that important on a basic level.
    These are some topics or ability tests that the question should cover: what is the target environment, the ability to recognize a C# program, the knowledge that it's a managed language, that there's a difference between value types and reference types (maybe not so basic, but certainly fundamental), the basics of classes - that it defines a type, that it can have members, like fields, properties and methods, and the difference between a class and an instance, and maybe some other questions, depending on what knowledge its supposed to test for.

    How many questions do you need? Are all of them to be in the same format? And could you more precisely specify how basic is "BASIC"? That is, what is the knowledge being tested? Basic info and the simple ability to recognize C# code? The ability to write a simple C# program. The basic ability to use some elements of the .NET library? What?

  8. #8
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    To answer your questions:

    This sample test is to test the new functionality, but it will also go live on the site, so it will be real content.

    The 'basic' was just to do something fun and relatively easy. I can do a set of questions on any topic. While each post could have an unlimited number of questions with an unlimited number of answers, I'd prefer to create something that is between 5 and 10 questions long with 10 seeming to be a good target.

    The format of the questions/answer is multiple choice. I can work any HTML markup into the question and the answers, so that gives a little flexibility. There is no free form coding or anything like that in this first example. Questions can have an unlimited number of answers, as I indicated, but I suggest keeping it between two and five.

    In addition to the questions and answers, I also have the ability to display a response if the person answers the question wrong. As such, this gives us a chance to indicate which answer was correct and why the others might have been wrong. It also let's us do things such as point (link) to the FAQs that have been created on the forum for more information.

    This isn't a revolutionary feature, but it should be interesting. In addition to this basic quiz for C#, I can do quizzes on any programming topic. I'll create a word doc template that can be used to set up a new "Tech IQ" test in case someone wants to build a couple for the site.

    I could see these set up broadly or specific. For example:

    Tech IQ: Test your knowledge of Windows 8 (broad)
    Tech IQ: Test your knowledge of Generics in C# (pretty specific)

    I'd be curious to see someone write 10 questions that are super hard-core C# (or VB or C++) as a test under a title such as "Are you a hardcore C# developer?" (or VB or C++). Those are a bit more difficult though, so I thought I'd try to start with 10 simple, basic questions on C# to get a sample build and launched.


    Make sense? I've rambled a bit, so if it doesn't, let me know....
    Last edited by Brad Jones; March 12th, 2013 at 01:17 PM.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  9. #9
    Join Date
    Jan 2010
    Posts
    1,099

    Re: Building a test - Basic C#

    Here are some suggestions. You'll notice that most of them ask very basic questions about classes, that is, they are about a fundamental OO concept, rather than things like functions, variables, conditionals, control flow statements, etc. This is inevitable since in C# you can't make anything that's not a part of a class. Sure, one could still circumvent this to some extent, but IMO, it's a wrong way to introduce the language to a beginner. Thus, all of these questions are rather general in nature, and ask about the basics of the C# language, without going to much into the details of the actual code. I understand that beginners might not be able to answer some of the questions, but, hey, it's a great opportunity for them to learn something important.

    The format I used here, for the sake of clarity is:
    Question?
    • Correct answer
    • -
    • A list of wrong answers.


    The answers offered should be shuffled, of course. Please correct any grammar mistakes you spot.

    Which of the following is a valid "Hello world" program in C#?
    • use your example


    Which one of these represents a standard entry point to a desktop program?
    // Note: had to specify "desktop", since now this is different for Win Store Apps (unless I'm mistaken)
    • public static void Main()
    • -
    • public static class Program
    • public void Main()
    • Console.WriteLine();
    • Application.Run(new Form1());
    • namespace MyApplication
    • using System.Windows.Forms;
    • public static void Run()


    What are the names of the most commonly used fundamental types supported by the language?
    • int, float, double, bool, string
    • -
    • do, for, while, break, as, continue
    • void, out, switch, if, goto, using
    • Console.WriteLine(), Console.ReadLine(), Application.Run()


    What is a class?
    • A user-defined type, which represents some concept by describing it in terms of state and associated behaviors.
    • -
    • A user-defined function, which can be used from other parts of the program.
    • A predefined body of code which is generated by an IDE when a new C# project is started.
    • Another name for a C# file.


    Which of these denote basic kinds of class members?
    • Fields, properties and methods.
    • -
    • Console.WriteLine(), Console.ReadLine(), return
    • Input parameters, output parameters, and a return type.
    • A backing field, a get block, and a set block.
    • Namespaces, modules and assemblies.


    How classes represent state (data) and behavior?
    • Class fields and properties are used to represent state, while methods implement behaviors.
    • -
    • Class fields and poperties represent behaviors, while methods store state.
    • Class fields and methods are used to represent state, while properties implement behaviors.
    • Classes represent only state, never behavior.
    • Classes do not represent state or behavior, they just define new types.


    What is the public interface of a class?
    • The public interface comprises all the public class members.
    • -
    • The public interface comprises all non-public class members.
    • The public interface comprises public properties only.
    • The public interface comprises public methods only.
    • The public interface comprises public events only.
    • The public interface is an abstract data type that is implemented by concrete classes.


    What is the difference between classes and their instances (objects)?
    • Classes define a type, a blueprint of sorts, from which individualized objects of the class can be created.
    • -
    • While objects need to be created from classes, there's effectively no difference between them.
    • Classes are reference types, while objects are value types.
    • Objects define an abstract type, from which individual, concrete classes can be derived.
    • Classes can have private members, while objects cannot.


    How objects of different types generally interact?
    • Via the public interfaces of their respective types.
    • -
    • Via their private members (events, methods, properties, fields).
    • Via events defined in the Form class.
    • Via saving and reading data to/from a file.
    • Via a database.


    What is the difference between value types and reference types?
    • Value types directly contain their data, and are passed around by value (copied), while reference types point indirectly to their data and are passed by reference.
    • -
    • Value types directly contain their data, but are passed around by reference, while reference types, which point to their data indirectly, get passed by value.
    • Value types indirectly point to their data, and are passed by value, wheres reference types contain their data directly, and are passed by reference.
    • There is no significant difference, other than that the value types are meant to be small and simple, while classes can be more complex.



    Which of these is true?

    • Classes define reference types, while structs define value types.
    • -
    • Classes define value types, while structs define reference types.
    • Both classes and structs define reference types.
    • Both classes and structs define value types.
    • Classes and structs do not define types, they define objects.


    Which statement is correct?
    • C# is compiled to an intermediate language, which is then in turn just-in-time compiled (upon execution) via the runtime to platform-specific bytecode.
    • -
    • C# is an interpreted language, but can be compiled for a specific platform.
    • C# is compiled to an intermediate language, which can then can be interpreted by the runtime only on Windows.
    • C# is interpreted, and due to the fact that it is managed cannot be compiled, but C# programs can be run on several platforms.


    C# is a managed language. What this means?
    • Memory allocation and deallocation, and some other aspects of the program, are managed by the runtime, not the programmer.
    • -
    • It means that it comes with an IDE which has advanced project management capabilities.
    • It includes database management libraries and tools.
    • It is based on a standard which is managed and developed by Microsoft.



    If that's somewhat inadequate, we could formulate some questions about variables, methods, metod parameters and return types, method calls, etc. - the traditional, non-OO imperative programming.


    P.S. If anyone spots some errors, please report.
    Last edited by TheGreatCthulhu; March 12th, 2013 at 10:18 PM.

  10. #10
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    I need to edit the text on this a little bit, but go ahead and check out:

    Tech IQ: Are You Better than a C# Rookie?
    http://www.codeguru.com/quizzes/tech...-c-rookie.html

    No going backwards, so make sure you pick the right answer the first time!

    Brad!
    Last edited by Brad Jones; March 19th, 2013 at 09:26 AM.
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  11. #11
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,421

    Re: Building a test - Basic C#

    As a note - this is the first Tech IQ to get posted. There are some bugs we are still working to fix. For example, the text has been initial cap'd. It shouldn't be. That is being fixed. If you see any other issues with the functionality of this, feel free to chime in.

    If you want to create a new Tech IQ, I've created a guideline document that is also rough, but I'll go ahead and attach it.

    TechIQ Guidelines.docx

    Brad!
    -----------------------------------------------
    Brad! Jones, CodeGuru.com Site Director
    Developer.com Network Director / EiC

    webmaster@codeguru.com
    (My Latest Book)


    -----------------------------------------------

  12. #12
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,451

    Re: Building a test - Basic C#

    I had a few strange things happen. On one of the missed answers the correct answer didn't show up like on others. At some points during the quiz, I was not able to select an answer and have to refresh the screen to be able to continue. I am using Chrome as the browser.

  13. #13
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: Building a test - Basic C#

    I noticed a spelling error in Q6, 1 st answer: poperties
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  14. #14
    Join Date
    Jan 2010
    Posts
    1,099

    Re: Building a test - Basic C#

    There's an error on the first question - the correct answer is 3 (the one with the static Main()). When an option different than 1 is chosen, the error/info message (wrongly) says that the right answer is 1, but correctly displays the code from the answer 3.

    BTW: you can re-do the test by deleting codeguru.com cookies (specifically, the one with the name "b2b_techIQ_CSharpBeginning").

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center