Programming Fundamentals at Radboud University | Flashcards & Summaries

Select your language

Suggested languages for you:
Log In Start studying!

It looks like you are in the US?
We have a website for your region.

Take me there

Lernmaterialien für Programming fundamentals an der Radboud University

Greife auf kostenlose Karteikarten, Zusammenfassungen, Übungsaufgaben und Altklausuren für deinen Programming fundamentals Kurs an der Radboud University zu.

TESTE DEIN WISSEN

What does the WriteLine method do?


Lösung anzeigen
TESTE DEIN WISSEN

This method prints out (output) the information (variables, integers, doubles en string and much more) on the screen and does this always on a new line. The Console.Write method prints out information but does this always on the same line.

Lösung ausblenden
TESTE DEIN WISSEN

How many bits is a byte?


Lösung anzeigen
TESTE DEIN WISSEN

A byte is 8 bits.

Lösung ausblenden
TESTE DEIN WISSEN

What is a class?

Lösung anzeigen
TESTE DEIN WISSEN

It is a group that contains data and methods. They are contained within braces tha belong to the namespace. It is like a classification system.

Lösung ausblenden
TESTE DEIN WISSEN

How would you create the constructor with arguments?


Lösung anzeigen
TESTE DEIN WISSEN

class Cost

{

    private double amount;

    private double price;

    

    public Cost(double a) // This is the constuctor

    {

        amount = a;

        price = .35;

    }


    public double Calc() // This is a method to include a return value of a calculation

    {

        return amount * price;

    }

}


// Now you can call the constuctor with an object.

Lösung ausblenden
TESTE DEIN WISSEN

Give an example of how to code a namespace.

Lösung anzeigen
TESTE DEIN WISSEN

using System;


namespace Csharp_namespace

{

    class MyClass

    {

    public MyClass()

    {

        Console.WriteLine("My Class");

    }

    }

}

    class MyClient

    {

    public static void Main()

    {

        //Using the fully qualified name to     access the namespace member.

        Csharp_namespace.MyClass mc = new 

        Csharp_namespace.MyClass();

    }

    }

Lösung ausblenden
TESTE DEIN WISSEN

Give an example of using 2 or more different namespaces with the same classes.


Lösung anzeigen
TESTE DEIN WISSEN

using System;

 

// Nested Namespace

namespace MyNamespace

{

    namespace Nested

    {

        public class SampleClass

        {

            public static void myMethod()

            {

                Console.WriteLine("Nested Namespace Example");

            }

        }

    }

}

 

namespace MyProgram

{

    public class MyClass

    {

        public static void Main()

        {

            MyNamespace.Nested.SampleClass.myMethod();

        }

    }

}

Lösung ausblenden
TESTE DEIN WISSEN

What are some things you have to remember about a constructor?


Lösung anzeigen
TESTE DEIN WISSEN

1. The constructor name must match the class name, and it cannot have a return type (like void or int).


2. The constructor is called when the object is created.


3. All classes have constructors by default: if you do not create a class constructor yourself, C# creates one for you. However, then you are not able to set initial values for fields.

Lösung ausblenden
TESTE DEIN WISSEN

How can you create a method?


Lösung anzeigen
TESTE DEIN WISSEN

1. within the class code block create '(you could also add public if you want to use it outside the class) "static void myMethod() {}"

2. within the curly brackets of myMethod() add the code you'd want.

3. you can add parameters in between the parenthesis of myMethod(), for example;

static void myMethod(string fname)

{

   Console.WriteLine(fname + "you are it!");

}

4. You can call the method in the static void Main(string[] args){} method.

Lösung ausblenden
TESTE DEIN WISSEN

What does args in the main method stand for?


Lösung anzeigen
TESTE DEIN WISSEN

It is a parameter in the main method that accesses a string array that is called args, this is in array that is populated with several command-line arguments from the operating system. This makes configurating programs less complex.

Lösung ausblenden
TESTE DEIN WISSEN

Give an example of constuctor overloading;

Lösung anzeigen
TESTE DEIN WISSEN

// C# program to Demonstrate the overloading of 

// constructor when the types of arguments 

// are different

using System;

  

class ADD {

      

    int x, y;

    double f;

    string s;

  

    // 1st constructor

    public ADD(int a, double b)

    {

        x = a;

        f = b;

    }

  

    // 2nd constructor

    public ADD(int a, string b)

    {

        y = a;

        s = b;

    }

Lösung ausblenden
TESTE DEIN WISSEN

What is important for the writeline method to work?


Lösung anzeigen
TESTE DEIN WISSEN

1. You have to write the message within openening and closing parenthesis (). This is the containter for the information.

2. You have to write everything between double quotes, with the exception of variables and so on.

3. Every output of the writeline method is always in string datatype.

Lösung ausblenden
TESTE DEIN WISSEN

How many byte is a kilobyte?


Lösung anzeigen
TESTE DEIN WISSEN

A kilobyte is 2^10 bytes or also 1024 bytes.

Lösung ausblenden
  • 23306 Karteikarten
  • 290 Studierende
  • 3 Lernmaterialien

Beispielhafte Karteikarten für deinen Programming fundamentals Kurs an der Radboud University - von Kommilitonen auf StudySmarter erstellt!

Q:

What does the WriteLine method do?


A:

This method prints out (output) the information (variables, integers, doubles en string and much more) on the screen and does this always on a new line. The Console.Write method prints out information but does this always on the same line.

Q:

How many bits is a byte?


A:

A byte is 8 bits.

Q:

What is a class?

A:

It is a group that contains data and methods. They are contained within braces tha belong to the namespace. It is like a classification system.

Q:

How would you create the constructor with arguments?


A:

class Cost

{

    private double amount;

    private double price;

    

    public Cost(double a) // This is the constuctor

    {

        amount = a;

        price = .35;

    }


    public double Calc() // This is a method to include a return value of a calculation

    {

        return amount * price;

    }

}


// Now you can call the constuctor with an object.

Q:

Give an example of how to code a namespace.

A:

using System;


namespace Csharp_namespace

{

    class MyClass

    {

    public MyClass()

    {

        Console.WriteLine("My Class");

    }

    }

}

    class MyClient

    {

    public static void Main()

    {

        //Using the fully qualified name to     access the namespace member.

        Csharp_namespace.MyClass mc = new 

        Csharp_namespace.MyClass();

    }

    }

Mehr Karteikarten anzeigen
Q:

Give an example of using 2 or more different namespaces with the same classes.


A:

using System;

 

// Nested Namespace

namespace MyNamespace

{

    namespace Nested

    {

        public class SampleClass

        {

            public static void myMethod()

            {

                Console.WriteLine("Nested Namespace Example");

            }

        }

    }

}

 

namespace MyProgram

{

    public class MyClass

    {

        public static void Main()

        {

            MyNamespace.Nested.SampleClass.myMethod();

        }

    }

}

Q:

What are some things you have to remember about a constructor?


A:

1. The constructor name must match the class name, and it cannot have a return type (like void or int).


2. The constructor is called when the object is created.


3. All classes have constructors by default: if you do not create a class constructor yourself, C# creates one for you. However, then you are not able to set initial values for fields.

Q:

How can you create a method?


A:

1. within the class code block create '(you could also add public if you want to use it outside the class) "static void myMethod() {}"

2. within the curly brackets of myMethod() add the code you'd want.

3. you can add parameters in between the parenthesis of myMethod(), for example;

static void myMethod(string fname)

{

   Console.WriteLine(fname + "you are it!");

}

4. You can call the method in the static void Main(string[] args){} method.

Q:

What does args in the main method stand for?


A:

It is a parameter in the main method that accesses a string array that is called args, this is in array that is populated with several command-line arguments from the operating system. This makes configurating programs less complex.

Q:

Give an example of constuctor overloading;

A:

// C# program to Demonstrate the overloading of 

// constructor when the types of arguments 

// are different

using System;

  

class ADD {

      

    int x, y;

    double f;

    string s;

  

    // 1st constructor

    public ADD(int a, double b)

    {

        x = a;

        f = b;

    }

  

    // 2nd constructor

    public ADD(int a, string b)

    {

        y = a;

        s = b;

    }

Q:

What is important for the writeline method to work?


A:

1. You have to write the message within openening and closing parenthesis (). This is the containter for the information.

2. You have to write everything between double quotes, with the exception of variables and so on.

3. Every output of the writeline method is always in string datatype.

Q:

How many byte is a kilobyte?


A:

A kilobyte is 2^10 bytes or also 1024 bytes.

Programming fundamentals

Erstelle und finde Lernmaterialien auf StudySmarter.

Greife kostenlos auf tausende geteilte Karteikarten, Zusammenfassungen, Altklausuren und mehr zu.

Jetzt loslegen

Das sind die beliebtesten Programming fundamentals Kurse im gesamten StudySmarter Universum

Fundamentals of computing

American University in Cairo

Zum Kurs
Fundamentals of Nursing

Saint Mary's University

Zum Kurs
Programming CH2

King Khaled University

Zum Kurs
Computer Fundamentals and Programming

University of Perpetual Help, System Dalta

Zum Kurs
Laws Fundamentals

Western Mindanao State University

Zum Kurs

Die all-in-one Lernapp für Studierende

Greife auf Millionen geteilter Lernmaterialien der StudySmarter Community zu
Kostenlos anmelden Programming fundamentals
Erstelle Karteikarten und Zusammenfassungen mit den StudySmarter Tools
Kostenlos loslegen Programming fundamentals