Interview Questions

  1. What is the difference between html and html5
  2. Tag name available in html5
  3. What is javascript
  4. What is ajax and its benefits
  5. what is the different type of request available in ajax
  6. what is jquery and its benefits
  7. Main difference between javascript and jquery
  8. Event in jquery
  9. example of jquery event
  10. what is difference between CSS and CSS3
  11. what is media query in CSS
  12. What is bootstrap
  13. what is grid system in bootstrap
  14. What is JSON
  15. What is API
  16. What is PHP
  17. what is variable in PHP
  18. what types of variable available in PHP
  19. what is array in PHP
  20. how many types of array available in PHP
  21. difference between associative array and multidimentional array
  22. Difference between library function and user defined function in php
  23. Give me example of library function
  24. Difference between sessions and cookies
  25. What is difference between get and post method
  26. What is database
  27. What is table
  28. What is database MYSQL queries
  29. Type of relationship available in MYSQL
  30. Which datatype is use to store image in table
  31. What is OOPS
  32. Difference between classes and objects
  33. What is the different type array function in PHP
  34. Difference between concat() and array_push()
  35. Difference between constructor() and destructor()
  36. Types of error available in PHP
  37. Difference between library file and helper file
  38. Give me any three datatype of date and time
  39. What is blob in MYSQL
  40. Difference between RDBMS and DBMS
  41. Difference between string datatype and varchar datatype
  42. Difference between text datatype and String datatype
  43. What is datatype in MYSQL
  44. What are the meaning of classes and objects
  45. Difference between argument and parameter
  46. difference between cookies and local storage
  47. what is the difference between session storage and local storage
  48. Difference between notice error and warning error
  49. What is the library
  50. Difference between authentication and authorization
  51. What is MVC
  52. What is polymorphism
  53. Difference between Primary key and foreign key
  54. What is the full form of DOM and give its types
  55. Can table have more than one primary key

TCET Session Data

day 2:
javascript: addeventlisterner, fetchapi, validation
mongodb: crud on terminal
nodejs: core, custom module, http module
expressjs: routeing with get,post, put, delete methods
routing with route methods
read query params using res.query
read form data using res.body parser
read raw json using res.body parser
mongodb crud using nodejs (mongoose)

Day 1: JavaScript
Introduction
console.log()
console.error()
console.warning()
alert()
confirm()

variables, datatypes and scope
var x | let x | x

concatenation
template literals hello ${name}

Conditional Statement if..else

Loops for

String and String methods

Array and Array methods

Math methods

Functions

callback function

lambda expression/fatarrow function

Classes and Objects

Array of Objects

Inheritance

Interface

JSON

Array of JSON

AJAX using fetch API and json-placeholder dummy API

UI
read data from input box
put data in input box
put data in html

addEventListener

events (onclick, onkeyup, onkeydown, onkeypress, onfocus, onchange, onblur)

JavaScript Validation

Load data in table from API (Web Service: json-placeholder) using AJAX call (fetch API)

=====================================================================

rsync on windows os

rsync: Failed to exec ssh: No such file or directory(2) on windows

nstalling cwrsync, you are likely to get this error  when you try to run this sample command from the command line.

rsync  -avz  -e  ssh ycsoftware@google.com:/home/ycsoftware /cygdrive/z/ycsoftware/

“rsync: Failed to exec ssh: No such file or directory(2)” cwrsync

The reason you are getting this is because for some reason rsync is not able to find the path to the ssh.exe file. You should change it to something like this:

C:/cygwin64/bin/rsync.exe -ar . /cygdrive/c/xampp/htdocs/test2/

Ref: http://ycsoftware.net/rsync-failed-to-exec-ssh-no-such-file-or-directory2-on-windows/

Angular 4 http post with php

Component or Service:

let data = {'title': 'foo',	'body': 'bar', 'userId': 1};
    this.http.post('http://localhost/angular4/angcrud/add_student_action.php', data)
      .subscribe(
        (res:Response) => {
          console.log(res.json());
        },
        err => {
          console.log("Error occured");
        }
      );

 

Php Script:

<?php


$postdata = file_get_contents("php://input");
$request = json_decode($postdata);

header('Content-type: application/json');
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Headers: X-Requested-With, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers');
//$res_ar = array("foo"=> $_REQUEST['body']);


echo json_encode($request);

?>


<form #studentForm = "ngForm" (ngSubmit)="addStudentRecord(studentForm.value)">
  First name:<br>
  <input type="text" name="firstname" value="Mickey" ngModel>
  <br>
  Last name:<br>
  <input type="text" name="lastname" value="Mouse" ngModel>
  <br><br>
  <input type="submit" value="Submit">
</form>

 

programs on pointers

  1. WAP to exchange values of 2 variables by calling a function exchange
  2. WAP to find length of a string by calling a function lenght
  3. WAP to copy contents of one string into another by calling a function copy.
  4. WAP to reverse contents of a string
  5. WAP to find sum of 10 int values by calling a function sum (passing array as an argument)
  6. WAP to find mean of 10 in values by calling a function MEAN (passing array as an argument)
  7. WAP to dynamically read n values and find their sum
  8. WAP to read information about n students and display them
  9. WAP to find area and circumference of a circle by calling a single function circle
  10. WAP to call functions area and circumference of circle by using function pointer
  11. WAP to count total number of words in a string by calling a function wcount
  12. WAP to read a String and coutn total vowels in that string
  13. WAP to read a string and count total no of digits in that string
  14. WAP to read a string and copy it into another array
  15. WAP to rad a string and reverse that string

Hibernate Native SQL

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package corehibernatedemo;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import model.Person;
import model.Student;
import model.Users;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author Shailesh Sonare
 */
public class CoreHibernateDemo {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws ParseException {
        // TODO code application logic here
        /*
        Configuration cfg = new Configuration();
        cfg.configure("hibernate.cfg.xml");
        
        StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties());
        
        SessionFactory factory = cfg.buildSessionFactory(ssrb.build());
        
        Session session = factory.openSession();
        
        Transaction t = session.beginTransaction();
        
        List users = session.createQuery("from Users").list();
        System.out.println("done...");
        
        for (Iterator iterator = users.iterator(); iterator.hasNext();) {
            Users e = (Users) iterator.next();
            System.out.println(e.getFirstName());
        }
        
        
        
        Date bdate = new SimpleDateFormat("yyyy-MM-dd").parse("1992-11-15");
        
        Users  usr = new Users("Sunita", "Sonare", bdate);
        
        String hql = "UPDATE Users SET dob = :dob WHERE id = :id";
        
        Query query = session.createQuery(hql);
        query.setParameter("dob", bdate);
        query.setParameter("id", 4);
        query.executeUpdate();
        
        //session.save(usr);
        t.commit();
        session.close();
        System.out.println("DOne....");
        */
        
        //Student s = new Student();
        
        Configuration cfg = new Configuration().configure("hibernate.cfg.xml");
        
        StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties());
        
        SessionFactory factory = cfg.buildSessionFactory(ssrb.build());
        
        Session session = factory.openSession();
        
//        String hql = "FROM Users";
//        List<Users> list = session.createQuery(hql).list();

        String sql = "SELECT first_name, last_name, dob FROM users";
        
        SQLQuery query = session.createSQLQuery(sql);
        query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); // important when you are using alias <key><value> pair
//        List<Object[]> rows = query.list();
//        
//        for(Object[] row : rows){
//            
//            Users u = new Users(row[0].toString(), row[1].toString(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(row[2].toString()));
//            System.out.println(u);
//            System.out.println("--------------");
//        }

        List list = query.list();
        
        for(Object obj : list){
            Map map = (Map)obj;
            System.out.println("" + map.get("first_name"));
            System.out.println("" + map.get("last_name"));
            System.out.println("" + map.get("dob"));
            System.out.println("-------------------------");
        }
    }
    
}

 

 

Users.java

package model;
// Generated 30 May, 2017 5:20:27 PM by Hibernate Tools 4.3.1


import java.util.Date;

/**
 * Users generated by hbm2java
 */
public class Users  implements java.io.Serializable {


     private Integer id;
     private String firstName;
     private String lastName;
     private Date dob;

    public Users() {
    }

    public Users(String firstName, String lastName, Date dob) {
       this.firstName = firstName;
       this.lastName = lastName;
       this.dob = dob;
    }
   
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    public String getFirstName() {
        return this.firstName;
    }
    
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return this.lastName;
    }
    
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public Date getDob() {
        return this.dob;
    }
    
    public void setDob(Date dob) {
        this.dob = dob;
    }

    @Override
    public String toString() {
        return "Users{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", dob=" + dob + '}';
    }

}


 

Structure

  1. WAP to read Information about Student and Display it.
    (Information: Roll Number, Name, Age, Sex)
  2. WAP to read Information about an Employee and Display it.
    (Information: EmpNo, Name, Job, Sal)
  3. WAP to read Information about a Worker and Print Payment
    (Information: Name, Wages, WorkingDays)
  4. WAP to read information about 10 workers and print their Payment.
    Print Average Payment
    (Information: Name, Wages, WorkingDays)
  5. WAP to read co-ordinates of end point of a line and find its slope by using the structure
    struct Line{
    int x1, y1, x2, y2;
    }
  6. WAP to read information about student
    (Roll No. Name, Birth Date, Admission Date) by using following structure
    struct date {
    int D, M, Y;
    }
    struct Student {
    int RollNo;
    char name[20];
    struct date bdate;
    struct date admsndate;
    }

Arrays Programs (Multi Dimensional)

  1. WAP to read a matrix of size 3 X 5 and find their SUM
  2. WAP to read a matrix of size 3 X 5 and find sum of each ROW
  3. WAP to read a matrix of size 3 X 3 and check if it is NULL or NOT
  4. WAP to read a matrix of size 3 X 5 and count all EVEN and ODD numbers
  5. WAP to read matrix of size 3 X 3 and check if it is UNIT Matrix or NOT
  6. WAP to read 2 matrix of size 3 X 3 and find their Addition
  7. WAP to read 2 matrix of size 3 X 3 and find their Product
  8. WAP to read matrix of size 3 X 3 and find its Transpose
  9. WAP to read matrix of size 3 X 3 and find its Transpose without using second matrix
  10. WAP to read matrix of size 3 X 3 and find its Upper Triangular Matrix
  11. WAP to read matrix of size 3 X 3 and find its Lower Triangular Matrix
  12. WAP to read matrix of size 3 X 3 and check if sum of its diagonal is same or not
  13. WAP to read matrix of size 3 X 3 and check if sum of its middle row is same as sum of its middle column
  14. WAP to create TIC-TAC-TOE by showing number and take 9 inputs from 2 users.
    1 2 3
    4 5 6
    7 8 9

    X O X
    O X O
    O O X

    PLAYER 1 WIN
    O X O
    X O X
    O X O

    PLAYER 2 WIN