Tuesday 17 December 2019

IBM off campus drive December 2019 coding programs

1. Sum of arithmetic progression numbers. Eg: 1+2+3+4+5 =15
2. Print number in reverse binary. Eg: Decimal =9      Binary= 1001
3. Convert number to Roman numerals.
          Eg:     Symbol         I      V        X        L
                     Value            1      5        10       50
4. Area of an ellipse.
5. Print the pyramid.
              *
           * * *
       * *  *  * *
6. Time taken to start a job , first come first serve(FCFS)

What is cyber physical system (CPS)?


A cyber-physical system (CPS) is a mechanism controlled by a computer based algorithm, strongly integrated with internet and its users. 
Examples of CPS are as follows: medical monitoring, process control systems, smart grid, robotics systems, autonomous automobile systems and automatic pilot avionics.

Friday 13 December 2019

Python Comments

Python Comments can be used to
                  - explain Python code.
                  - make the code more readable.

Comments starts with a #, and Python will ignore them:
Single line comment
Examples
1)     #This is a comment
        print("Good Morning")
2)     print("Welcome") #This is a comment
3)    #print("Good Morning")
        print("Good Evening")

Multi Line Comments
Python does not really have a syntax for multi line comments.
To add a multiline comment you could insert a # for each line:
Example
#This is a comment
#written in
#more than just one line
print("good evening")

Multiline string(triple quotes)
multiline string (triple quotes) place your comment inside it
Example

"""
This is a comment
written in
more than just one line
"""
print("Hello, Good Morning")

Python Keywords

Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers.

and as assert break class
continue def del elif else
exceptFalsefinallyfor from
global if import in is
lambda None nonlocal not or
pass raise return True  try
while with yield

What is Python ?


  • Python is a programming language.
  • Python is a case-sensitive language.
  • It was created by Guido van Rossum, and released in 1991.
  • Python is used for web development (server-side), software development and mathematics.
  • Python can connect to database systems.
  • Python can be used to handle big data and perform complex mathematics.
  • Python is a cross-platform language,It means that Python works on different platforms i.e Windows, Mac OS X, Linux, Raspberry Pi, etc.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-orientated way or a functional way.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.




Saturday 19 October 2019

Cognizant Technical questions - off campus drives - October 2019

Technical questions
1. What is Relational database?
2. What is liner search?
3. Palindrome program with explanation?
4. what is foreign key?
5. Difference between data mining and data warehouse?
6. what is database?
7. What is primary key?
8. What is binary search?
9. Explain constraints in dbms?
10. Explain data structures?
11. Java basics
12. Sorting techniques
13. String concepts
14. Difference between C and Java
15. bubble sort program in c
16. Write a Insert query?
17. Explain oops concepts?
18. Explain about project
19. prime number program in c
20. arrays ascending order in c

Friday 18 October 2019

ZOHO Coding Round Programs with Answers

1. Given a set of numbers like <10,36,54,89,12> we want to find sum of weights based on the following conditions.
                           1. 5 if a perfect square
                           2. 4 if multiple of 4 and divisible by 6
                           3. 3 if even number
And sort the numbers based on the weight and print it as follows
<10,its weight>, <36,its weight><89,its weight>
Should display the numbers based on increasing order.


2. Print the word with odd letters as
             P                  M
               R             A
                  O     R
                     G
                   O    R
               R           A
             P                M

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

int main() {
    char s[]="PROGRAM";
    int n=strlen(s);
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==j || i+j==n-1)
            {
                printf("%c",s[i]);
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }
   
    return 0;
}

3. Print the elements in anti spiral order
for example
Matrix
1  2  3
4  5  6
7  8  9

output
5 6 9 8 7 4 1 2 3

4. given an array of integers rearrange the array in such a way that the first element is first maximum and second element is first minimum.

Example
Input - {1,2,3,4,5,6,7}
Output - {7,1,6,2,5,3,4}

5. Remove unbalanced parentheses in a given expression.
Example
Input:   ((abc)((de))
Output: ((abc)(de))

Input: (((ab)
Output: (ab)

6.Form a number system with only 3 and 4. Find the nth number of the number system.
Example
3,4,33,34,43,44,333,334,343,344,433,434,443,444 and so on.

7. Check whether a given mathematical expression is valid.
Example
Input:  (a+b)(a*b)         Output: Valid
Input: (ab)(ab+)            Output: Invalid
Input:  ((a+b)                Output: Invalid

8.Write a program to give the following output for the given input:
Example1
Input:  a1b10                output: abbbbbbbbbb
Example2
Input:  b3c6d15            output: bbbccccccddddddddddddddd
The number varies from 1 to 99.

9. Using recursion reverse the string such as:
Example
Input:  alpha beta gamma
Output: gamma beta alpha

10. Given two sorted arrays, merge them such that the elements are not repeated.
Input:
      Array 1 : 2,4,5,6,7,9,10,13
      Array 2 : 2,3,4,5,6,7,8,9,11,15
Output:
      Merged array:
2,3,4,5,6,7,8,9,10,11,13,15


11. Given a string, reverse only vowels in it; leaving rest of the string as it is.
Input:  abcdef
Output: ebcdaf

12. Write a program to determine whether a given number can be expressed as sum of two prime numbers or not.
For example, 34 can be expressed as sum of two prime numbers but 23 cannot be.

13. Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words. See following examples for more details.
Consider the following dictionary 
{ i, like, sam, sung, samsung, mobile, ice, cream, icecream, man, go, mango} 
Input: ilike 
Output: Yes 
The string can be segmented as "i like". 

Input: ilikesamsung 
Output: Yes
The string can be segmented as "i like samsung"

14. Print the following pattern.
                           1
                         3  2 
                       6  5  4 
                   10  9  8  7 
                   10  9  8  7 
                       6  5  4 
                         3  2
                           1
15. Given an array as input, The condition is if the number is repeated you must add the number and put the next index value to 0. If the number is 0 print it at the last.
Eg: arr[] = { 0, 2, 2, 2, 0, 6, 6, 0, 8} 
      Output: 4 2 12 8 0 0 0 0 0

16. Two strings of equal length will be given. Print all the adjacent pairs which are not equal. 
Input: asdfghij and adsfgijh 
Output: sd-ds, hij-ijh

17. From the input sentence given, find the strings which are not palindrome and print it. 
Input: he knows malayalam 
Output: he knows

18. Given two Strings s1 and s2, remove all the characters from s1 which is present in s2. 
Input: s1=”expErIence”, 
           s2=”En” 
output: s1=”exprIece”

19. Given an array with repeated numbers, Find the top three repeated numbers. 
input: array[]={3, 4, 2, 3, 16, 3, 15, 16, 15, 15, 16, 2, 3} 
output: 3, 16, 15

20. It’s about anagram. input was array of strings .and a word was given to find whether it has anagram in given array. 
Input:  catch, got, tiger, mat, eat, Pat, tap, tea 
Word: ate 
Output: eat, tea

Sunday 15 September 2019

Cocubes essay writing topics for Capgemini - September -2019

1. Analog vs digital
2. Change is only the constant.
3. Students nowadays can learn much more than what is taught inside the classroom.
4. The road less traveled is not necessarily the wrong one.
5. Success vs ethics
6. You can not judge a book by its cover
7. Can honestly be taught?
8. A chain is only as strong as its weakest link.
9. It's a lonely journey to the top.

Saturday 7 September 2019

HR Interview questions and answers for freshers

1. Tell me about your self?
My name is narendra. I live in Tirupati. I have done M.Tech in computer science and engineering.
Job experience if any (internships).
Family details in short.

2. Why do you want to work at our company?
 Tell them what you like about company.
Relate it to your long-term career goals.

For Example
Sir/Madam, it is great privilege for anyone to work in a reputed company like yours. When I read about your company I found that my skills are matching your requirements. Where I can showcase my technical skills to contribute to the company growth.

3. What are your strengths?
Interviewers want to know how your strengths beneficial for the company.
Taking Initiative.
Creativity
Self motivated
Persistence - regular in your work.
Adaptability -  adjustable to any kind of environment situation.
Hard working
Optimistic - positive attitude.
Fast decision making

For Example
I am a self motivated and hardworking with positive attitude towards my career and my life.

4. What are your Weakness? (The strategy: Turn a strength into a weakness)

I work too hard.
Too detail oriented.

5. Why should I hire you?

Sir/Madam, as I am a fresher, I have theoretical knowledge but I can do hard work for my organization. And I will put all my efforts for the good progress of organization. Being punctual and sincere, I can finish the work given to me on time and try my best to fulfill all the needs of company from me.





Friday 6 September 2019

Cocubes essay writing topics for Capgemini - September -2018

1. Newspapers will become extinct in the next 20 years.
2. Rome was not built in a day.
3. The gap between laptops and smartphones is decreasing.
4. Time once lost, is lost forever.
5. Books or people, whom do we learn more from?
6. Records are meant to be broken?
7. Artificial Intelligence a threat or a boon?
8. Hard-work or talent which one is more important to succeed in workplace?