Framework Fundamentals

Similar documents
Chapter 5 Object-Oriented Programming

Object-Oriented Programming

Introduction to Programming Using Java (98-388)

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

C++ Important Questions with Answers

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

Inheritance, Polymorphism, and Interfaces

CS-202 Introduction to Object Oriented Programming

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Chapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Inheritance and Polymorphism

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.

Chapter 12: How to Create and Use Classes

Polymorphism. Zimmer CSCI 330

CSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.)

Java Fundamentals (II)

Microsoft Visual Basic 2005: Reloaded

Programming II (CS300)

CIS Intro to Programming in C#

Object-Oriented Programming in C# (VS 2015)

Course Syllabus C # Course Title. Who should attend? Course Description

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

Data Structures (list, dictionary, tuples, sets, strings)

CMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are "built" on top of that.

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Class, Variable, Constructor, Object, Method Questions

C++ Crash Kurs. Polymorphism. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck

Course Hours

Programming II (CS300)

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#)

Object-Oriented Programming in C# (VS 2012)

C# Programming for Developers Course Labs Contents

OVERRIDING. 7/11/2015 Budditha Hettige 82

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:

Object Oriented Programming with c++ Question Bank

QUIZ. Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed?

Compaq Interview Questions And Answers

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

DOT NET Syllabus (6 Months)

Fall Problem Set 1

CS 162, Lecture 25: Exam II Review. 30 May 2018

Object Oriented Programming. Solved MCQs - Part 2

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1

Microsoft Visual C# Step by Step. John Sharp

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University

Assigned Date: August 27, 2014 Due Date: September 7, 2015, 11:59 PM

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C#

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

VALLIAMMAI ENGINEERING COLLEGE

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

HAS-A Relationship. Association is a relationship where all objects have their own lifecycle and there is no owner.

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Agenda. Objects and classes Encapsulation and information hiding Documentation Packages

Lesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)

Polymorphism Part 1 1

Object-Oriented Concept

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

CS313D: ADVANCED PROGRAMMING LANGUAGE

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Outline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism.

Today. Book-keeping. Inheritance. Subscribe to sipb-iap-java-students. Slides and code at Interfaces.

Inheritance. Inheritance allows the following two changes in derived class: 1. add new members; 2. override existing (in base class) methods.

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Declarations and Access Control SCJP tips

More C++ : Vectors, Classes, Inheritance, Templates

ITI Introduction to Computing II

C# Programming in the.net Framework

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh

Polymorphism. return a.doublevalue() + b.doublevalue();

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

INHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Chapter 1: Object-Oriented Programming Using C++

CMSC202 Computer Science II for Majors

Topic 7: Algebraic Data Types

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed

COP 3330 Final Exam Review

The C# Programming Language. Overview

Short Notes of CS201

CHAPTER 7 OBJECTS AND CLASSES

Making New instances of Classes

CH. 2 OBJECT-ORIENTED PROGRAMMING

ITI Introduction to Computing II

CS201 - Introduction to Programming Glossary By

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

CS/ENGRD 2110 SPRING Lecture 7: Interfaces and Abstract Classes

Transcription:

Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable integer? A. Nullable(int) i = null; B. Nullable<int> i = null; C. int i = null; D. int<nullable> i = null; 3. Which of the following are reference types? (Choose all that apply.) A. Types declared Nullable B. String C. Exception D. All types derived from System.Object 4. What is the correct order for catch clauses when handling different exception types? A. Most general to most specific B. Most likely to occur to least likely to occur C. Most specific to most general D. Least likely to occur to most likely to occur 5. Of the following scenarios, which would be a good reason to use the String-Builder class instead of the String class? A. When building a string from shorter strings B. When working with text data longer than 256 bytes C. When you want to search and replace the contents of a string D. When a string is a value type 6. Why should you close and dispose of resources in a finally block instead of a catch block? A. It keeps you from having to repeat the operation in each catch. B. A finally block runs whether or not an exception occurs. C. The compiler throws an error if resources are not disposed of in the finally block. D. You cannot dispose of resources in a catch block. 7. You create an application with built-in exception handling. For some types of exceptions, you want to add an event to the Event Log that specifies the line of code that initiated the exception. Which Exception property should you use? A. Message B. StackTrace C. Source D. Data 8. You pass a value-type variable into a procedure as an argument. The procedure changes the variable; however, when the procedure returns, the variable has not changed. What happened? (Choose one.) A. The variable was not initialized before it was passed in. B. Passing a value type into a procedure creates a copy of the data. C. The variable was redeclared within the procedure level. D. The procedure handled the variable as a reference.

9. Which of the following statements are true? (Choose all that apply.) A. Inheritance defines a contract between types. B. Interfaces define a contract between types. C. Inheritance derives a type from a base type. D. Interfaces derive a type from a base type. 10. Which of the following are examples of built-in generic types? (Choose all that apply.) A. Nullable B. Boolean C. EventHandler D. System.Drawing.Point 11. You create a generic class in which you store field members whose type is generic. What do you do to dispose of the objects stored in the fields? A. Call the Object.Dispose method. B. Implement the IDisposable interface. C. Derive the generic class from the IDisposable class. D. Use constraints to require the generic type to implement the IDisposable interface. 12. You ve implemented an event delegate from a class, but when you try to attach an event procedure you get a compiler error that there is no overload that matches the delegate. What happened? A. The signature of the event procedure doesn t match that defined by the delegate. B. The event procedure is declared Shared/static, but it should be an instance member instead. C. You mistyped the event procedure name when attaching it to the delegate. D. The class was created in a different language. 13. You are creating a class that needs to be sorted when in a collection. Which interface should you implement? A. IEquatable B. IFormattable C. IDisposable D. IComparable 14. Why should boxing be avoided? A. It adds overhead. B. Users must have administrative privileges to run the application. C. It makes code less readable. 15. Structures inherit ToString from System.Object. Why would someone override that method within a structure? (Choose all that apply.) A. To avoid boxing B. To return something other than the type name C. The compiler requires structures to override the ToString method D. To avoid run-time errors caused by invalid string conversions 16. If there is no valid conversion between two types, what should you do when implementing the IConvertible interface? A. Delete the ToType member that performs the conversion. B. Throw an InvalidCastException. C. Throw a new custom exception reporting the error. D. Leave the member body empty.

17. With strict conversions enabled, which of the following would allow an implicit conversion? (Choose all that apply.) A. Int16 to Int32 B. Int32 to Int16 C. Int16 to double D. double to Int16 OOPS Implementation Inheritance 1. C#.NET provides inheritance in which two ways? 2. What is implementation inheritance? 3. Which of the following statements are true? (Choose all that apply.) A. Abstract classes cannot be instantiated B. Abstract classes can contain all four types of members C. Abstract methods can be private D. An abstract method can be created in nonabstract class 4. Can a method be declared as sealed in base class? 5. Which of the following statements are true? (Choose all that apply.) A. Abstract classes can contain non-abstract methods B. Abstract classes cannot contain fields C. An abstract method can have implementation in base class D. An abstract class must contain an abstract member Interface Inheritance 6. Which of the following statements are true? (Choose all that apply.) A. Inheritance defines a contract between types. B. Interfaces define a contract between types. C. Inheritance derives a type from a base type. D. Interfaces derive a type from a base type. 7. C# supports multiple inheritance. (State true or false) 8. Which of the following statements are true? (Choose all that apply.) A. Fields are not allowed in interfaces. B. Interfaces can provide implementation to some methods C. We cannot provide accessibility modifier for methods inside an interface D. Classes cannot inherit from more than one interface 9. Can an interface class be called an abstract class? 10. What is the default accessibility modifier for the methods inside an interface?

11. What is interface inheritance? Polymorphism 12. What does the keyword virtual mean for a method? A. The method cannot be overridden B. The method must be implemented by derived class. C. The method cannot be accessed directly. D. The method can be overridden. 13. In which two ways is polymorphism supported in C#.NET? 14. What keyword should be applied to override a virtual method? 15. Which of the following statements are true? A. We cannot override private virtual methods B. We can declare an overridden method as static even if the base method is non-static C. Virtual methods can be written in interfaces D. Virtual methods can be written in abstract Classes 16. All methods are virtual by default in C#.NET. (State true or false) 17. Override modifier can be applied to which of the following members? (Choose all that apply) A. Methods B. Fields C. Properties D. Events 18. How can we call a base class method from a derived class? 19. How can we hide a base class method which is not marked virtual? 20. Which of the following statements is true (with reference to methods in a single class)? A. We can have two methods with similar name and parameters but different return type B. We can have two methods with the same name and parameter types, but in a different order C. All methods with the same name must have the same return type D. We cannot have two methods with same name even if the signature is different 21. What is the difference between method overriding and method overloading? 22. Which of the following statements are true?(choose all that apply) A. Every base class and derived class relationship is polymorphic B. In early binding the method/class/object is associated during runtime C. Polymorphism improves performance D. In C#.NET new keyword supports dynamic binding 23. Method overloading is type of polymorphism Constructors & Destructors 24. Which of the following statements is true A. Constructors can be only public B. It is mandatory to have a constructor for a class C. C# provides a default constructor even if a constructor is provided for the class explicitly

D. Constructor is a method in a class 25. To call a base class constructor in derived class, it must be explicitly called. (State true or false) 26. What is the order of execution of constructors in a derived class A. First base class constructor is executed and then derived class constructor B. First derived class constructor and then base class constructor C. Only derived class constructor is executed D. Only base class constructor is executed irrespective of whether derived class consists of default or explicitly written constructor 27. Which of the following statements are true with respect to static constructors? A. Static constructors cannot have any other modifier B. Static constructors can initialize non-static variables C. We cannot invoke a static constructor D. Static constructors are executed after all other constructors are executed 28. Can static constructors be overloaded? 29. What is the return type of a constructor? 30. Does C# create a default constructor if there is only static constructor in it? Exercises 1. Design two interfaces One declaring a method to calculate population density and another interface with method to calculate budget deficit. Create two classes called Country and State extending these two interfaces and implement the above given methods in them. Method for calculating population density should have parameters for total population and total area. Population density=total population/total area Similarly for calculating budget deficit the parameters should be allocated amount and actual expenses. Deficit=actual expenses-allocated amount. 2. Design two simple interfaces. The first interface has a method called PriceDetails() which writes a given number in words. The second interface has a method also called PriceDetails() which checks whether a number is greater than 10000 or not and outputs the result by displaying a message that the amount is eligible for a free gift (if greater than 10000). Create a class called Item extending these two interfaces and implement the above methods in it. 3. Create an abstract class called Vehicle with fields price, mileage. Also specify a non- abstract method called TestSpeed() with parameters distance and timetaken and an abstract method called AvgDailyCost() with parameters distance and fuelprice. Create two classes called Car and Bike extending the Vehicle class and use the above methods.

4. Create an abstract class called Shape with fields base width, color and no.of sides. Create an abstract method called Area() in it. Create two derived classes called Rectangle and Triangle. These two classes should have a separate method called Circumference() in each of them with different parameters.