Software Development Flashcards
5 cards from real MTA practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 5 Software Development flashcards as text
Which of the following is a data type in C#?
Answer: int
In C#, `int` is a fundamental data type used to store whole numbers, also known as integers. It is one of the primitive data types provided by the language, along with others like `float`, `double`, `char`, and `bool`. Options like Function, Method, and Class are programming constructs or blueprints, not basic types for storing values.
Which of the following best describes object-oriented programming (OOP)?
Answer: Programming that uses classes and objects to represent real-world entities
Object-Oriented Programming (OOP) is a programming paradigm that organizes software design around data, or objects, rather than functions and logic. It uses classes as blueprints to create objects, which encapsulate both data (attributes) and behavior (methods) to model real-world entities. This approach promotes modularity, reusability, and maintainability through concepts like encapsulation, inheritance, and polymorphism.
What is the purpose of a constructor in a class?
Answer: To provide a way to instantiate an object
A constructor is a special method within a class that is automatically invoked when an object of that class is created, or instantiated. Its primary purpose is to initialize the newly created object's state, setting initial values for its fields and performing any necessary setup. Constructors ensure that an object is in a valid and usable condition immediately after its creation.
Which of the following is a feature of encapsulation in object-oriented programming?
Answer: Reducing the visibility of an object's internal data
Encapsulation is a core principle of object-oriented programming that involves bundling data (attributes) and the methods that operate on that data within a single unit, typically a class. A key feature of encapsulation is data hiding, which means restricting direct access to an object's internal data and only allowing interaction through public methods. This protects the object's internal state from external misuse and promotes modularity.
In the .NET Framework, which method is used to read a line of input from the console?
Answer: Console.ReadLine()
In C# and the .NET Framework, the `Console.ReadLine()` method is specifically used to read an entire line of text input from the standard input stream, which is typically the console. It waits for the user to type text and press Enter, then returns the entered text as a string. Other `Console` methods like `Write()` and `WriteLine()` are for output, while `Read()` reads only a single character.