C crash course

Day 1: Introduction to C Programming

  • Session 1 (3 hours): Introduction to C Programming.
  • Explanation: Learn about the basics of C programming, the structure of a C program, and how to use the printf function to display output.
  • Syntax Example:
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

Assignment 1: Write a program that displays “Hello, World!” on the screen.

Output:

  Hello, World!

Assignment 2: Create a program that calculates the area of a rectangle using user-provided width and height.

#include <stdio.h>

int main() {
    float width, height, area;

    printf("Enter width: ");
    scanf("%f", &width);

    printf("Enter height: ");
    scanf("%f", &height);

    area = width * height;
    printf("Area: %.2f\n", area);

    return 0;
}

Output (example):

  Enter width: 4.5
  Enter height: 7.2
  Area: 32.40
  • Session 2 (3 hours): Data types, variables, and basic input/output.
  • Explanation: Learn about different data types, how to declare variables, and use the scanf function to read user input. Perform basic arithmetic calculations.
  • Syntax Example:
#include <stdio.h>

int main() {
    int num1, num2, sum;

    printf("Enter two numbers: ");
    scanf("%d %d", &num1, &num2);

    sum = num1 + num2;
    printf("Sum: %d\n", sum);

    return 0;
}
  • Assignment 1: Write a program that takes user input for two numbers, adds them, and displays the result. Output (example):
  Enter two numbers: 3 5
  Sum: 8

Assignment 2: Develop a program that converts temperature from Fahrenheit to Celsius.

“`c
#include

int main() {
    float fahrenheit, celsius;

    printf("Enter temperature in Fahrenheit: ");
    scanf("%f", &fahrenheit);

    celsius = (fahrenheit - 32) * 5 / 9;
    printf("Temperature in Celsius: %.2f\n", celsius);

    return 0;
}

Output (example):

  Enter temperature in Fahrenheit: 68
  Temperature in Celsius: 20.00

Day 2: Control Flow and Functions

  • Session 1 (3 hours): Conditional statements (if, else if, else), logical operators.
  • Explanation: Learn about conditional statements to make decisions in your program based on conditions. Use logical operators to combine conditions.
  • Syntax Example:
#include <stdio.h>

int main() {
    int num;

    printf("Enter a number: ");
    scanf("%d", &num);

    if (num > 0) {
        printf("Positive\n");
    } else if (num < 0) {
        printf("Negative\n");
    } else {
        printf("Zero\n");
    }

    return 0;
}
  • Assignment 1: Write a program that checks if a given number is positive, negative, or zero.
    Output (example):
  Enter a number: -7
  Negative
  • Assignment 2: Create a program that determines the largest of three user-provided numbers.
```c
#include <stdio.h>

int main() {
    int num1, num2, num3, largest;

    printf("Enter three numbers: ");
    scanf("%d %d %d", &num1, &num2, &num3);

    if (num1 >= num2 && num1 >= num3) {
        largest = num1;
    } else if (num2 >= num1 && num2 >= num3) {
        largest = num2;
    } else {
        largest = num3;
    }

    printf("Largest: %d\n", largest);

    return 0;
}
```

Output (example):

  Enter three numbers: 15 9 12
  Largest: 15
  • Session 2 (3 hours): Loops (while, for) and switch statements.
  • Explanation: Learn how to create loops for repetitive tasks using while and for. Use the switch statement for multiple choices.
  • Syntax Example:
#include <stdio.h>

int main() {
    int num, i;

    printf("Enter a number: ");
    scanf("%d", &num);

    for (i = 1; i <= 10; i++) {
        printf("%d * %d = %d\n", num, i, num * i);
    }

    return 0;
}
  • Assignment 1: Implement a program that prints a multiplication table for a given number. Output (example):
  Enter a number: 7
  7 * 1 = 7
  7 * 2 = 14
  ...
  7 * 10 = 70

Assignment 2: Write a program that calculates the sum of all even numbers between 1 and a user-provided limit using a loop.

#include <stdio.h>

int main() {
    int limit, sum = 0, i;

    printf("Enter a limit: ");
    scanf("%d", &limit);

    for (i = 2; i <= limit; i += 2) {
        sum += i;
    }

    printf("Sum of even numbers: %d\n", sum);

    return 0;
}

Output (example):

  Enter a limit: 10
  Sum of even numbers: 30

Day 3: Arrays and Strings

  • Session 1 (3 hours): Introduction to arrays, declaring and initializing arrays.
  • Explanation: Learn about arrays, how to declare them, and access their elements. Understand the concept of indexing and looping through arrays.
  • Syntax Example:
#include <stdio.h>

int main() {
    int numbers[5] = {10, 20, 30, 40, 50};

    printf("Third element: %d\n", numbers[2]);

    return 0;
}
  • Assignment 1: Write a program to find the sum of all elements in an array. Output (example):
  Sum of array elements: 150
  • Assignment 2: Develop a program that finds the smallest element in an array of integers.
#include <stdio.h>

int main() {
    int array[5] = {25, 10, 15, 20, 5};
    int smallest = array[0], i;

    for (i = 1; i < 5; i++) {
        if (array[i] < smallest) {
            smallest = array[i];
        }
    }

    printf("Smallest element: %d\n", smallest);

    return 0;
}

Output (example):

  Smallest element: 5
  • Session 2 (3 hours): Introduction to strings, string functions (strlen, strcpy, etc.).
  • Explanation: Learn about strings in C, which are arrays of characters. Explore various string functions for manipulation.
  • Syntax Example:
#include <stdio.h>

int main() {
    char name[20] = "John";
    printf("Hello, %s!\n", name);

    return 0;
}
  • Assignment 1: Create a program that checks if a given string is a palindrome. Output (example):
  Enter a string: radar
  Palindrome

Assignment 2: Write a program that counts the number of vowels in a user-provided string.

#include <stdio.h>
#include <string.h>

int main() {
    char str[100];
    int i, vowels = 0;

    printf("Enter a string: ");
    scanf("%s", str);

    for (i = 0; i < strlen(str); i++) {
        char ch = tolower(str[i]);
        if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
            vowels++;
        }
    }

    printf("Number of vowels: %d\n", vowels);

    return 0;
}

Output (example):

  Enter a string: education
  Number of vowels: 5

Day 4: Pointers and Memory Management

  • Session 1 (3 hours): Pointers, pointer arithmetic, and references.
  • Explanation: Learn about pointers, memory addresses, and how to use pointers to manipulate variables and arrays.
  • Syntax Example:
#include <stdio.h>

int main() {
    int num = 5;
    int *ptr = &num;

    printf("Value of num: %d\n", num);
    printf("Value at ptr: %d\n", *ptr);

    return 0;
}
  • Assignment 1: Write a program that swaps the values of two variables using pointers. Output (example):
  Before swapping: num1 = 5, num2 = 10
  After swapping: num1 = 10, num2 = 5
  • Assignment 2: Develop a program that uses pointers to reverse an array of integers. Output (example):
  Original array: 5 10 15 20 25
  Reversed array: 25 20 15 10 5
  • Session 2 (3 hours): Dynamic memory allocation (malloc, free) and memory leaks.
  • Explanation: Understand dynamic memory allocation using malloc, and how to free allocated memory using free. Learn to prevent memory leaks.
  • Syntax Example:
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *arr;
    int n, i, sum = 0;

    printf("Enter the number of elements: ");
    scanf("%d", &n);

    arr = (int *)malloc(n * sizeof(int));

    if (arr == NULL) {
        printf("Memory allocation failed.\n");
        return 1;
    }

    for (i = 0; i < n; i++) {
        printf("Enter element %d: ", i + 1);
        scanf("%d", &arr[i]);
        sum += arr[i];
    }

    printf("Average: %.2f\n", (float)sum / n);

    free(arr);

    return 0;
}
  • Assignment 1: Implement a program that dynamically creates an array, populates it with user input, and calculates the average. Output (example):
  Enter the number of elements: 4
  Enter element 1: 12
  Enter element 2: 15
  Enter element 3: 20
  Enter element 4: 10
  Average: 14.25

Assignment 2: Write a program that removes duplicates from an array using dynamic memory allocation.

#include <stdio.h>
#include <stdlib.h>

int* removeDuplicates(int *arr, int *size) {
    int *temp = (int *)malloc(*size * sizeof(int));

    if (temp == NULL) {
        printf("Memory allocation failed.\n");
        exit(1);
    }

    // ... code to remove duplicates ...

    return temp;
}

int main() {
    // ... code to input array ...

    int *result = removeDuplicates(array, &size);

    // ... code to display result ...

    free(result);

    return 0;
}

Output (example):

  Original array: 5 10 15 10 20 25 15 30
  Array after removing duplicates: 5 10 15 20 25 30

Day 5: Functions, Structures, and File I/O

  • Session 1 (3 hours): Functions, function prototypes, and header files.
  • Explanation: Learn about functions, how to declare and define them. Understand the concept of recursion for solving problems.
  • Syntax Example:
#include <stdio.h>

int factorial(int n) {
    if (n == 0 || n == 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

int main() {
    int num;

    printf("Enter a positive integer: ");
    scanf("%d", &num);

    printf("Factorial of %d is %d\n", num, factorial(num));

    return 0;
}
  • Assignment 1: Write a program that calculates the factorial of a given number using a recursive function. Output (example):
  Enter a positive integer: 5
  Factorial of 5 is 120

Assignment 2: Create a program that calculates the nth term of the Fibonacci sequence using a recursive function.

#include <stdio.h>

int fibonacci(int n) {
    if (n <= 1) {
        return n;
    }
    return fibonacci(n - 1) + fibonacci(n - 2);
}

int main() {
    int num;

    printf("Enter a positive integer: ");
    scanf("%d", &num);

    printf("Fibonacci(%d) = %d\n", num, fibonacci(num));

    return 0;
}

Output (example):

  Enter a positive integer: 7
  Fibonacci(7) = 13
  • Session 2 (3 hours): Introduction to structures and file I/O.
  • Explanation: Learn about structures, how to define them, and how to use them to group related data. Explore file input/output operations.
  • Syntax Example:
#include <stdio.h>

struct Student {
    char name[50];
    int marks[3];
};

int main() {
    struct Student student1;

    printf("Enter student name: ");
    scanf("%s", student1.name);

    printf("Enter marks for three subjects: ");
    scanf("%d %d %d", &student1.marks[0], &student1.marks[1], &student1.marks[2]);

    // ... code to calculate grade ...

    return 0;
}
  • Assignment 1: Develop a program that reads data from a text file, calculates the sum and average, and writes the results to another file. Output (example):
  Sum: 85
  Average: 17.00

Assignment 2: Write a program that reads student data from a file, calculates their grades, and outputs the result to another file.

#include <stdio.h>

struct Student {
    char name[50];
    int marks[3];
};

char calculateGrade(int marks) {
    // ... code to calculate grade ...
}

int main() {
    FILE *inputFile = fopen("students.txt", "r");

FILE *outputFile = fopen(“grades.txt”, “w”);

    struct Student student;

    while (fscanf(inputFile, "%s %d %d %d", student.name, &student.marks[0], &student.marks[1], &student.marks[2]) != EOF) {
        // ... code to calculate grade ...

        fprintf(outputFile, "Student Name: %s\n", student.name);
        fprintf(outputFile, "Marks: %d %d %d\n", student.marks[0], student.marks[1], student.marks[2]);
        fprintf(outputFile, "Grade: %c\n", calculateGrade(totalMarks));
    }

    fclose(inputFile);
    fclose(outputFile);

    return 0;
}

Output (example):

  Student Name: John Doe
  Marks: 80 85 90
  Grade: A
#include <stdio.h>

struct Student {
    char name[50];
    int marks[3];
};

char calculateGrade(int marks) {
    // ... code to calculate grade ...
}

int main() {
    FILE *inputFile = fopen("students.txt", "r");


    FILE *outputFile = fopen("grades.txt", "w");

    struct Student student;

    while (fscanf(inputFile, "%s %d %d %d", student.name, &student.marks[0], &student.marks[1], &student.marks[2]) != EOF) {
        // ... code to calculate grade ...

        fprintf(outputFile, "Student Name: %s\n", student.name);
        fprintf(outputFile, "Marks: %d %d %d\n", student.marks[0], student.marks[1], student.marks[2]);
        fprintf(outputFile, "Grade: %c\n", calculateGrade(totalMarks));
    }

    fclose(inputFile);
    fclose(outputFile);

    return 0;
}

Output (example):

  Student Name: John Doe
  Marks: 80 85 90
  Grade: A

Basics of Computer

Day 1: Introduction to Computers and Operating Systems

  • Topics:
  • Basic computer components and peripherals
  • Operating system fundamentals
  • Assignments:
  1. Identify and label the major components of your computer system.
  2. Explore the features and functionality of your operating system.
  3. Customize your desktop background and screensaver.

Day 2: File Management and Organization

  • Topics:
  • Creating, copying, moving, and deleting files and folders
  • Organizing files and folders
  • Assignments:
  1. Create a new folder on your desktop and name it “Assignments.”
  2. Copy files from one folder to another.
  3. Delete unnecessary files and empty your recycle bin or trash folder.

Day 3: Internet Basics and Web Browsing

  • Topics:
  • Internet fundamentals
  • Web browser usage and navigation
  • Assignments:
  1. Open a web browser and visit three different websites of your choice.
  2. Bookmark your favorite website for quick access.
  3. Perform a simple web search to find information on a topic of interest.

Day 4: Email Communication and Online Safety

  • Topics:
  • Email account setup and management
  • Online safety and security best practices
  • Assignments:
  1. Create a new email account with a service provider of your choice.
  2. Compose and send an email to a friend or family member.
  3. Update your email account settings to enable spam filtering and two-factor authentication.

Day 5: Online Search and Information Evaluation

  • Topics:
  • Effective online searching techniques
  • Evaluating the reliability and credibility of online information
  • Assignments:
  1. Perform an advanced search using search operators to find specific information.
  2. Evaluate the credibility of a website by examining its domain, author, and references.
  3. Create a list of reliable online sources for future reference.

Day 6: Online Communication and Social Media

  • Topics:
  • Instant messaging and video calling
  • Social media platforms and their features
  • Assignments:
  1. Install a messaging app and send a message to a friend or family member.
  2. Set up a video call with someone using a communication tool like Skype or FaceTime.
  3. Create a profile on a social media platform and explore its features, such as posting and commenting.

Day 7: Online Privacy and Security

  • Topics:
  • Protecting personal information online
  • Recognizing and avoiding online scams
  • Assignments:
  1. Review the privacy settings of your social media accounts and adjust them to your comfort level.
  2. Learn about common online scams and how to identify and avoid them.
  3. Install and run antivirus software to ensure your computer’s security.

Day 8: Online Shopping and Financial Transactions

  • Topics:
  • E-commerce websites and online shopping
  • Online payment methods and security
  • Assignments:
  1. Browse an e-commerce website and add items to your cart to simulate online shopping.
  2. Research different online payment methods and understand their security measures.
  3. Create a budget using a spreadsheet application to track your expenses.

Day 9: Online Entertainment and Multimedia

  • Topics:
  • Streaming services and media players
  • Digital photo and video management
  • Assignments:
  1. Explore a streaming service and watch a movie or TV show of your choice.
  2. Install a media player on your computer and play your favorite songs or videos.
  3. Organize your digital photos into folders and create a slideshow using a photo management application.

Day 10: Online Learning and Productivity Tools

  • Topics:
  • Online learning platforms and resources
  • Productivity tools for personal and professional use
  • Assignments:
  1. Enroll in an online course or explore educational resources on a learning platform.
  2. Use a productivity tool like Google Docs or Microsoft Office Online to create a document or presentation.
  3. Research and install a task management application to organize your daily activities and to-do lists.

Assignment

Day 1: Introduction to Computers and Operating Systems

  1. Explain the main components of a computer system and their functions.
  2. Describe the difference between hardware and software.
  3. Discuss the purpose and features of an operating system.
  4. Identify three popular operating systems used today.
  5. Explain the importance of keeping your operating system and software updated.

Day 2: File Management and Organization with Google Drive

  1. Create a new folder in your Google Drive and name it “Assignments.”
  2. Upload a file to your Google Drive.
  3. Move a file from one folder to another in Google Drive.
  4. Share a file or folder with a friend and specify their access level (view, comment, or edit).
  5. Discuss the benefits of cloud storage and how Google Drive can help with file organization and accessibility.

Day 3: Internet Basics and Web Browsing

  1. Explain the purpose of a web browser and name three popular web browsers.
  2. Perform a search on Google and find information about a topic of interest.
  3. Bookmark a website that you frequently visit and organize it into a bookmark folder.
  4. Clear your browsing history and cookies in your web browser.
  5. Discuss the importance of internet safety, such as avoiding suspicious websites and protecting personal information.

Day 4: Email Communication and Google Drive Integration

  1. Create a new Gmail account and send an email to a friend.
  2. Attach a file from your Google Drive to an email.
  3. Save an email attachment to your Google Drive.
  4. Organize your Gmail inbox using labels and filters.
  5. Discuss the benefits of using Google Drive for file sharing and collaboration in email communication.

Day 5: Online Search and Information Evaluation

  1. Perform an advanced search on Google using specific search operators or filters.
  2. Evaluate the credibility of a website by examining the source, author, and references.
  3. Compare search results and information from different search engines.
  4. Discuss the importance of fact-checking and critically analyzing online information.
  5. Use Google Scholar to find scholarly articles on a specific topic.

Day 6: Online Communication and Collaboration Tools

  1. Create a Google Docs document and share it with a collaborator to work on together.
  2. Use the comment feature in Google Docs to provide feedback or suggestions.
  3. Start a video call using Google Meet and invite others to join.
  4. Collaborate on a Google Sheets spreadsheet with a teammate in real-time.
  5. Discuss the advantages of online communication and collaboration tools for remote work or group projects.

Day 7: Online Privacy and Security

  1. Review and adjust your Google account privacy settings.
  2. Enable two-factor authentication for your Google account.
  3. Identify and avoid common online scams, such as phishing emails or fake websites.
  4. Create a strong, unique password for your Google account.
  5. Discuss best practices for online privacy, such as using secure connections and being cautious with personal information.

Day 8: Google Slides and Presentations

  1. Create a new presentation using Google Slides.
  2. Customize the theme and layout of your slides.
  3. Add text, images, and shapes to your presentation.
  4. Apply transitions and animations to enhance your presentation.
  5. Share your presentation with others and allow them to comment or edit.

Day 9: Google Forms and Surveys

  1. Create a survey or questionnaire using Google Forms.
  2. Add different types of questions to your form, such as multiple choice or short answer.
  3. Customize the design and layout of your form.
  4. Share your form with others and collect responses.
  5. Analyze the survey results and generate visualizations using Google Sheets.

Day 10: Google Drive Organization and Productivity Tips

  1. Create a folder structure in your Google Drive to organize your files and documents.
  2. Use the Google Drive search feature to quickly find specific files or folders.
  3. Set up offline access to your Google Drive for accessing files without an internet connection.
  4. Explore additional productivity features in Google Drive, such as Google Keep for note-taking or Google Calendar for scheduling.
  5. Discuss how Google Drive can enhance your personal and professional productivity.

7 Day Assignment

Day 1: Introduction to Computers and Internet

  1. Write a short essay on the importance of computers in our daily lives.
  2. Create a diagram illustrating the basic components of a computer system.
  3. Research and list five popular websites and explain their purposes.
  4. Compare and contrast different types of computer operating systems.
  5. Write step-by-step instructions on how to connect to a Wi-Fi network.
  6. Explore different types of computer input devices and their functions.
  7. Create a presentation on the evolution of computers over time.
  8. Research and explain the concept of computer viruses and methods to protect against them.
  9. Write a report on the impact of technology on society and ethical considerations.
  10. Explore different internet browsers and document their key features and differences.

Day 2: Computer Software and Applications

  1. Install a software program of your choice and document the installation process.
  2. Explore different types of software applications (e.g., word processing, spreadsheet, image editing) and their uses.
  3. Customize the settings of your operating system to personalize your computer experience.
  4. Research and describe the concept of cloud computing and its advantages.
  5. Write a step-by-step tutorial on how to perform a specific task using a software application.
  6. Investigate different programming languages and their applications in software development.
  7. Create a presentation comparing proprietary software and open-source software.
  8. Research and explain the concept of software updates and the importance of keeping software up-to-date.
  9. Write a report on the role of artificial intelligence in software development.
  10. Explore different productivity tools and discuss their benefits in improving efficiency.

Day 3: Internet and Web Browsers

  1. Research and explain the purpose of domain names and how they are registered.
  2. Compare and evaluate different web browsers based on speed, security, and user interface.
  3. Clear browser cache and cookies and explain their importance.
  4. Research and describe the different types of internet connections available.
  5. Write a report on internet protocols (e.g., HTTP, TCP/IP) and their roles in web communication.
  6. Explore different search engines and compare their search algorithms.
  7. Identify and analyze common online scams and how to avoid them.
  8. Research and explain the concept of phishing attacks and how to recognize them.
  9. Create a checklist for evaluating the credibility of websites and online sources.
  10. Write a blog post on internet privacy and strategies to protect personal information online.

Day 4: Online Safety and Security

  1. Research and explain the concept of encryption and its importance in securing online communications.
  2. Create a strong and unique password for your online accounts and explain password security best practices.
  3. Research and compare different antivirus software programs and their features.
  4. Write a report on social engineering techniques and how to defend against them.
  5. Create a YouTube account and upload a short video introducing yourself.
  6. Explore YouTube’s privacy settings and customize them according to your preferences.
  7. Research copyright laws related to YouTube content and create a video discussing fair use guidelines.
  8. Comment on five different YouTube videos, expressing your opinions and engaging with the content creators.
  9. Create a YouTube playlist of your favorite videos on a specific topic or theme.
  10. Write a reflective essay on the impact of YouTube on media consumption and online entertainment.

Day 5: Basics of Google Drive and Cloud Storage

  1. Create a Google Drive account and explore its features and storage options.
  2. Upload a document to Google Drive and share it with a friend or colleague.
  3. Create a folder structure in Google Drive to organize your files and documents.
  4. Collaborate with others on a shared document using Google Docs
  5. Explore Google Drive’s integration with other Google apps like Google Sheets and Google Slides.
  6. Research and compare different cloud storage services, highlighting their features and pricing plans.
  7. Backup important files from your computer to Google Drive and explain the importance of data backup.
  8. Create a Google Form and use it to collect responses or conduct a survey.
  9. Explore Google Drive’s advanced search features to quickly find specific files or documents.
  10. Write a blog post comparing Google Drive to other cloud storage services and their advantages.

Day 6: Email and Communication Tools

  1. Set up an email account with a provider of your choice and configure it in an email client.
  2. Compose and send an email to a friend or family member, including attachments.
  3. Explore the features of your email client, such as organizing emails into folders and applying filters.
  4. Research and compare different email providers, highlighting their storage limits and security features.
  5. Create a professional email signature that includes your name, contact information, and any relevant links.
  6. Use a communication tool like Slack or Microsoft Teams to join a workspace and interact with others.
  7. Research and explain the concept of email etiquette and best practices for professional communication.
  8. Set up email forwarding or auto-responder for your email account and explain their purposes.
  9. Participate in an online discussion forum or community and share your thoughts on a topic of interest.
  10. Write a reflection on the benefits and challenges of online communication tools in modern society.

Day 7: Introduction to Social Media and Online Presence

  1. Create accounts on popular social media platforms like Facebook, Twitter, and Instagram.
  2. Customize your social media profiles with a profile picture, cover photo, and bio information.
  3. Post a status update on each social media platform, sharing your thoughts or an interesting article.
  4. Research and discuss the impact of social media on personal relationships and society.
  5. Explore privacy settings on social media platforms and adjust them according to your preferences.
  6. Follow influencers or organizations in your field of interest on social media and engage with their content.
  7. Create a blog on a free blogging platform and write your first blog post on a topic of your choice.
  8. Share your blog post on social media and engage with readers through comments and discussions.
  9. Explore social media analytics tools to track the performance of your posts and engagement metrics.
  10. Write a reflection on the benefits and drawbacks of social media and its influence on online culture.

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 + '}';
    }

}