Monday, December 31, 2018

ASP.NET MVC Interview Questions -- Part 3

ASP.NET MVC Interview Questions -- Part 3

  1. What are Validation Annotations?
  2. What is Data Annotation Validator Attributes in MVC?
  3. What is Validation Summary in MVC?
  4. What is the use of remote validation in MVC?
  5. Server Side Validation in MVC?
  6. How to make sure Client Validation is enabled in ASP.Net MVC?
  7. How to use Jquery Plugins in ASP.Net MVC validation?
  8. In Server how to check whether model has error or not in ASP.Net MVC?
  9. How can we create Custom Error Page in MVC?
  10. What is GET and POST Actions Types?
  11. How can we determine action invoked from HTTP GET or HTTP POST?
  12. Explain Test Driven Development (TDD) ?
  13. Why to use Html.Partial in MVC?
  14. What is Html.RenderPartial?
  15. What is RouteConfig.cs in MVC?
  16. What are Scaffold templates in MVC?
  17. Explain the concept of MVC Scaffolding?
  18. Explain the types of Scaffoldings.
  19. Can a view be shared across multiple controllers? If Yes, How we can do that?
  20. What are the components required to create a route in MVC?
  21. Why to use “{resource}.axd/{*pathInfo}” in routing in MVC?
  22. What are the two instances where routing is not implemented or required?
  23. What is Route Constraints in MVC?
  24. Can we add constraints to the route? If yes, explain how we can do it?
  25. What are the two ways to add constraints to a route?
  26. What are the possible Razor view extensions?
  27. What are the Main Razor Syntax Rules?
  28. What is PartialView in MVC?
  29. How do you create a partial view and consume it?
  30. What is the difference between View and Partial View?
  31. How we can add CSS in MVC?
  32. What is the use .Glimpse in MVC?
  33. What are the differences between Partial View and Display Template and Edit Templates in ASP.Net MVC?
  34. Explain the need of display mode in MVC.
  35. What is Representational State Transfer (REST) mean?
  36. Explain the tools used for unit testing in ASP.Net MVC?
  37. What are the different Approach in MVC using Entity Framework?
  38. What is Database First Approach in MVC using Entity Framework?
  39. What are the Folders in MVC application solutions?
  40. What are the methods of handling an Error in MVC?
  41. How can maintain session in MVC?
                 Click Here for Part 1            Click Here for Part 2

ASP.NET MVC Interview Questions -- Part 2

ASP.NET MVC Interview Questions -- Part 2

  1. Explain Bundle.Config in MVC.
  2. What is Route in MVC?
  3. Where is the route mapping code written?
  4. What is Default Route in MVC?
  5. How route table has been created in ASP.NET MVC?
  6. Which are the important namespaces used in MVC?
  7. In which assembly is the MVC framework is defined?
  8. What is ViewData?
  9. What is the difference between ViewBag and ViewData in MVC?
  10. What is the difference between Temp data, View, and View Bag?
  11. How can we pass the data From Controller To View In MVC?
  12. Explain using hyperlink how you can navigate from one view to other view?
  13. Explain TempData in MVC?
  14. What is Area in ASP.Net MVC?
  15. How we can register the Area in ASP.Net MVC?
  16. What are HTML Helpers in MVC?
  17. What is the difference between “HTML.TextBox” and “HTML.TextBoxFor”?
  18. What are AJAX Helpers in MVC?
  19. What are the Exception filters in MVC?
  20. How we can handle the exception at controller level in ASP.Net MVC?
  21. How can we do exception handling in MVC?
  22. What are the options can be configured in AJAX helpers?
  23. What is Layout in MVC?
  24. Explain Sections is MVC?
  25. Explain RenderSection in MVC?
  26. Explain RenderBody and RenderPage in MVC?
  27. What is ViewStart Page in MVC?
  28. Explain the methods used to render the views in MVC?
  29. What are the sub types of ActionResult?
  30. What is the difference between "ActionResult" and "ViewResult" ?
  31. What are Non Action methods in MVC?
  32. How to change the action name in MVC?
  33. Explain Peek method in Tempdata in ASP.Net MVC?
  34. Explain Keep method in Tempdata in ASP.Net MVC?
  35. How do you implement Forms authentication in MVC?
  36. What are Code Blocks in Views?
  37. What is Output Caching in MVC?
  38. What are the locations for Output Caching?
  39. How we can multiple submit buttons in ASP.Net MVC?
  40. What is the “HelperPage.IsAjax” Property?
  41. How we can call a JavaScript function on the change of a Dropdown List in MVC?
                 Click Here for Part 1            Click Here for Part 3

ASP.NET MVC Interview Questions -- Part 1

ASP.NET MVC Interview Questions -- Part 1

The ASP.NET MVC is a web application framework developed by Microsoft, which implements the model–view–controller (MVC) pattern.

Based on ASP.NET, ASP.NET MVC allows software developers to build a web application as a composition of three roles: Model, View and Controller. The MVC model defines web applications with 3 logic layers:

  • Model (business layer)
  • View (display layer)
  • Controller (input control)

  1. What is ASP.NET MVC?
  2. Explain Model, Controller and View in MVC?
  3. Define Controller in MVC?
  4. Explain Model in MVC?
  5. Explain View in MVC?
  6. Explain the page life cycle of MVC?
  7. Explain MVC application life cycle?
  8. Explain what are the steps for the execution of an MVC project?
  9. What are the advantages of MVC?
  10. What is Separation of Concerns in ASP.NET MVC?
  11. What is Razor View Engine?
  12. What is the meaning of Unobtrusive JavaScript?
  13. What is the use of ViewModel in MVC?
  14. Mention the advantages and disadvantages of MVC model?
  15. What you mean by Routing in MVC?
  16. What are the three segments for routing important?
  17. What are Actions in MVC?
  18. What is the importance of NonActionAttribute?
  19. How we can invoke child actions in ASP.Net MVC?
  20. What are Filters in MVC?
  21. Explain the role of "ActionFilters" in MVC?
  22. Mention some action filters which are used regularly in ASP.Net MVC?
  23. List out different return types of a controller action method?
  24. What are Action Filters in MVC?
  25. What "beforFilter()","beforeRender" and "afterFilter" functions do in Controller?
  26. What is the need of Action Filters in ASP.Net MVC?
  27. Explain the role of components Presentation, Abstraction and Control in MVC?
  28. What is Attribute Routing in MVC?
  29. How to enable Attribute Routing?
  30. Explain JSON Binding?
  31. What are Model Binders in ASP.Net MVC?
  32. Can I set the unlimited length for "maxJsonLength" property in config?
  33. What are child actions in ASP.Net MVC?
  34. What is JsonResultType in MVC?
  35. How to return the JSON from action method in ASP.Net MVC?
  36. How can I return string result from Action in ASP.Net MVC?
  37. Explain Dependency Resolution?
  38. What is Dependency Injection in ASP.Net MVC?
  39. Explain the advantages of Dependency Injection (DI) in ASP.Net MVC?
  40. Can I use Razor code in Javascript in ASP.Net MVC?
  41. What is Bundling and Minification in MVC?
                 Click Here for Part 2            Click Here for Part 3

Monday, December 17, 2018

Spark Interview Questions

Spark Interview Questions:

Spark is a framework which is heavily used in Hadoop(Hadoop 2.0/Yarn) in order to execute Analytical, Streaming , Machine Learning process in a very efficient way. I would like to take you through some of the questions those are frequently asked in any interview.

Spark:

1. What is Spark.
2. Explain higher level architecture of Spark.
3. What is Driver &Executor and explain the difference between them
4. What is DAG
5. How do you trace your failed job through DAG.
6. What is Persistence. Name difference level of Persistence.
7. Why do we use Repartittion & Coalesce
8. What is RDD,Dataframe & Dataset and explain difference between them
9. How to see partition after loading a input file in Spark.
10. How do we load/store any Hive table in Spark
11. How to read JSON,CSV file in Spark.
12. What is Spark Streaming.
13. Name some properties which you have set in your project
14. How could a Hive UDF be used in Spark session
15. Explain some troubleshooting in Spark
16. What is Stage,Job,Tasks in Spark
17. Difference between GroupByKey and ReduceByKey
18. What is executor memory and explain how did you set them in your project
19.Name some Spark functions which have been used in your project
20. What is Spark UDF and write the signature of the same. 

Friday, December 14, 2018

C# Interview Questions -- Part 3

C# Interview Questions -- Part 3

71. Explain Get and Set Accessor properties?
72. What is a Thread? What is Multithreading?
73. Name some properties of Thread Class.
74. What are the different states of a Thread?
75. What are Async and Await?
76. What is a Deadlock?
77. Explain Lock, Monitors, and Mutex Object in Threading.
78. What is a Race Condition?
79. What is Thread Pooling?
80. What is Serialization?
81. What are the types of Serialization?
82. What is an XSD file?
83. What are the different types of constructors in C#?
84. Is overriding of a function possible in the same class?
85. What is a collection?
86. What is the lock statement in C#?
87. What are the difference between IEnumerable and IQueryable.
88. What is the difference between early binding and late binding in C#?
89. Which are the access modifiers available in C#?
90. What is Hashtable?
91. What is Garbage Collection?
92. Explain sealed class.
93. Give an example of using sealed class in C#.
94. What are the two different types of errors in C#.
95. Do we get error while executing “finally” block in C#.
96. Mention the assembly name where System namespace lies in C#.
97. What are value types in C#?
98. What are reference types in C#?
99. Explain access modifier “protected internal” in C#.
100. What you mean by inner exception in C#.
101. Can we use delegates for asynchronous method calls in C#?
102. Why to use “Nullable Coalescing Operator” (??) in C#?
103. What is enum in C#?

                Click Here for Part 1            Click Here for Part 2

C# Interview Questions -- Part 2

C# Interview Questions -- Part 2

36. What are delegates?    
37. What is the base class in  net from which all the classes are derived from?   
38. What is the difference between method overriding and method overloading?    
39. What are the different ways a method can be overloaded?    
40. Why can't you specify the accessibility modifier for methods inside the interface?    
41. How can we set class to be inherited, but prevent the method from being over-ridden?    
42. What happens if the inherited interfaces have conflicting method names?    
43. What is the difference between a Struct and a Class?    
44. How to use nullable types in  Net?   
45. How we can create an array with non-default values?    
46. What is difference between is and as operators in c#?    
47. What's a multicast delegate?    
48. What are indexers in C#  NET?   
49. What is difference between the "throw" and "throw ex" in  NET?   
50. What are C# attributes and its significance?    
51. How to retrive attribute information at runtime?    
52. How to implement singleton design pattern in C#?    
53. What is the difference between directcast and ctype?    
54. Is C# code is managed or unmanaged code?
55. What are C# I/O Classes? What are the commonly used I/O Classes?
56. What is a Destructor in C#?
57. What is the difference between Continue and Break Statement?
58. What is the difference between finally and finalize block?
59  What is an Escape Sequence? Name some String escape sequences in C#.
60. What are Regular expressions? Search a string using regular expressions?
61. What are the basic String Operations? Explain.
62. What is Parsing? How to Parse a Date Time String?
63. What are Events?
64. How to use Delegates with Events?
65. What are the different types of Delegates?
66. What do Generic Delegates mean?
67. Explain Publishers and Subscribers in Events.
68. What are Synchronous and Asynchronous operations?
69. What is Reflection in C#?
70. What is a Generic Class?

                 Click Here for Part 1            Click Here for Part 3

C# Interview Questions -- Part 1

C# Interview Questions -- Part 1

C# is a general-purpose, multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed around 2000 by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C# is one of the programming languages designed for the Common Language Infrastructure.
C#'s development team is led by Mads Torgersen

1. What is C#?    
2. What are the fundamental OOP concepts?Explain    
3. Explain Code compilation in C#    
4. What are the types of comment in C#?    
5. Can multiple catch blocks be executed?    
6. Explain Namespaces in C#    
7. What is the difference between public, static and void?    
8. What is an object?    
9. Define Constructors?    
10. What is Jagged Arrays?    
11. What is the difference between ref & out parameters?    
12. What is the use of using statement in C#?    
13. What is serialization?    
14. Can "this" be used within a static method?    
15. What is difference between constants/"const" and read-only?    
16. What is an interface?    
17. What are the different types of classes in C#?    
18. What are value types and reference types?    
19. What are Custom Control and User Control?    
20. What are sealed classes in C#?    
21. What is method overloading?    
22. What is the difference between Array and Arraylist?    
23. Can a private virtual method be overridden?    
24. What are the different accessibility modifiers in c#?    
25. What are the differences between System String and System Text StringBuilder classes? 
26. What's the difference between the System Array CopyTo() and System Array Clone() ?
27. How can we sort the elements of the array in descending order?    
28. What's the difference between an interface and abstract class?    
29. What is the difference between Virtual method and Abstract method?    
30. What is the difference between Finalize() and Dispose() methods?    
31. What are circular references?    
32. What are generics in C# NET?   
33. What is an object pool in  NET?   
34. What are the commonly used types of exceptions in  Net?   
35. How is Exception Handling implemented in C#?

                 Click Here for Part 2            Click Here for Part 3

Python Dictionary

Dictionary in Python


It is an ordered collection of items. If you look at the other data structures of Python(i.e. list,tuple) they consist only value items, but Dictionary consists of Key,Value pair. As Python dynamically typed language there are no need to define variable type. We can directly define variable name.

We can create dictionary by below commands.

#Empty dictionary 
my_collections = {}


#Dictionary with same type of key
my_collections  = {1:'Rahul',2:'Shayam'}

#Dictionary with different type of keys
my_collections  = {'name':'Rahul',2:[2,3,4]}

We can access the dictionary by below commands.

my_collections1  = {1:'Rahul',2:'Shayam'}
my_collections2  = {'name':'Rahul',2:[2,3,4]}

my_collections1 [1]
my_collections2  ['name']

or

my_collections2 .get('name')

We can add/update the dictionary by below commands.

#update
my_collections2  ['name'] = 'John'

#add
my_collections2 ['age']= 23

We can delete/remove the dictionary by below commands.

cubes= {1:1, 2:8 3:27, 4:64, 5:125}

#Deleting particular item
cubes.pop(4)

#Deleting arbitrary item
cubes.popitem()

#Clearing Dictionary 
cubes.clear()



Thursday, December 13, 2018

Mutable and Immutable Collections

Mutable and Immutable Collections in Scala


In Scala language collections framework id typically of 2 types.

  • Mutable
  • Immutable


In Mutable Collections we can change,add or remove the elements. But, in case of immutable collections , they never change. Though you can perform addition, deletion, updation etc operations on the immutable data set but each time it will return you a new variable.

Package:
Mutable: scala.collection.mutable
Immutable: scala.collection.immutable

If you don't explicitly  specify any package name then by default it will point to immutable collection. Please find below some comparisons between two type of collections.

Properties
Mutable
Immutable
Manipulation of Variable
Possible
Not Possible
Speed
Faster
Slower
Memory Allocation
Once defined allocated into memory
In time of execution it uses memory
Data Security
Less
High
Use Case
In time of operations on data we should use this technique.
While exposing the data to end user/third party we should prefer this technique.



Tuesday, December 11, 2018

Create DataFrame from RDD


Creating DataFrame from RDD in Spark:

RDD and DataFrame both are highly used APIs in Spark framework. Converting RDD to DataFrame is a very common technique every programmer has to do in their programming. I would like to take you through the most suitable way to achieve this.

There are 2 most commonly used techniques.
- Inferring the Schema Using Reflection
- Programmatically specifying the schema

Inferring the Schema Using Reflection:

//Creating RDD
val rdd = sc.parallelize(Seq(1,2,3,4))
import spark.implicits._
//Creating Dataframe from RDD
val dataFrame = rdd.toDF()

//Creating Schema
case class Person(name: String, age: Int)
//Creating DataFrame using Refelction
val people = sc.textFile("SaleData.txt").map(_.split(",")).map(p => Person(p(0), p(1).toInt)).toDF()


Programmatically specifying the schema:

//Creating Schema function
def dfSchema(columnNames: List[String]): StructType =
  StructType(
    Seq(
      StructField(name = "name", dataType = StringType, nullable = false),
      StructField(gender= "gender", dataType = StringType, nullable = false),
      StructField(age= "age", dataType = IntegerType, nullable = false)
    )
  )

//Calling Schema function
val schema = dfSchema(Seq("name", "gender","age"))

//Creating RDD
val rdd: RDD[String] = ...

//Creating function to map Row data
def row(line: List[String]): Row = Row(line(0), line(1),line(2).toInt)

//Mapping Row Data
val data = rdd.map(_.split(",").to[List]).map(row)

//Creating DataFrame
val dataFrame = spark.createDataFrame(data, schema)


Saturday, December 8, 2018

PySpark Interview Questions

PySpark Interview Questions

Big Data is evolving day by day. Now big organizations are using Python on Spark in order to derive Analytics based solutions. I would like to share some interview questions.

1. What is Spark.
2. Tell me some use case where we prefer Python over Scala in Spark framework.
3. Difference between Python and Scala.
4. How will you execute Python script in Spark framework?
5. What is Pandas in Python?
6. What is Cython?
7. Explain OOPS Feature in Python?
8. What is dictionary in Python?
9. Difference between Tuple and List in Python?
10. Tell some package which you have used in your program.
11. What is anonymous function in Python and explain the use case.
12. What is module and how will you add one module into another?
13. How to handle python I/O operation.
14. How to handle exception in Python?
15. How will you execute Hive queries in Python?

Reading JDBC(Oracle/SQL Server) Data using Spark

Reading JDBC table data using Spark Scala


import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext

val conf = new SparkConf().setAppName(appName).setMaster(master)
val sc = new SparkContext(conf)
val sqlContext = new SQLContext(sc)

Reading JDBC:

sc.sqlContext .read.format("jdbc")
                               .option("url",<jdbc URL>)
                               .option("dbtable",<table name>)
                               .option("user",<user name>)
                               .option("password",<password>)
                               .option("driver",<Driver Name>)
                               .load

Driver Details:
SQL Server: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
Oracle: "oracle.jdbc.driver.OracleDriver"

URL Details:
SQL Server: "jdbc:sqlserver://<serverName><instanceName><:><portNumber>;<property1=value>;<property2=value>"
Oracle: "jdbc:oracle:thin:@localhost:1521:orcl"

** Please change the local host of Oracle JDBC URL depending on your server IP.
** You can use User Name and Password in place of Property1 and Property2 in time of  SQL Server JDBC URL creation. 




JSON File Parsing Using Spark Scala

Parsing JSON file in Spark:


First create object of Spark Context.


import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext


val conf = new SparkConf().setAppName(appName).setMaster(master)
val sc = new SparkContext(conf)
val sqlContext = new SQLContext(sc)

sc.sqlContext.read.option("multiline",<is_multiline>)
                              .option("mode","PERMISSIVE")
                              .option("quote","\"")
                              .option("escape","\u0000")
                              .json(<path>)


** is_multiline:Boolean = True/False
** path = JSON file Path


Wednesday, December 5, 2018

Python Interview Questions

Python Interview Questions 

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). Here some interview those are frequently asked in any interview.
1. What is Python?
2. How will you define function in Python?
3. What kind of typed of language Python is? Explain why?
4. How will you define variable in Python?
5. What are the different loops used in Python?
6. What kind of various String declaration are possible in Python?
7. Tell some built in function which is massively used for Scripting?
8. How to compile and run Python script?
9. Difference between Python and Shell.
10. What is Pandas in Python?
11. What is Cython?
12. Explain OOPS Feature in Python?
13. What is dictionary in Python?
14. Difference between Tuple and List in Python?
15. Tell some package which you have used in your program.
16. What is anonymous function in Python and explain the use case.


To check the answers click here.