Thursday, 21 March 2019

Make a file read-only to prevent changes


Read-only files have special property that their contents can't be modified, instead it can be read.
These files can also be copied, moved, renamed or deleted.
Following is the step-by-step procedure to make a file read-only:-
Step 1: Right click on the file you want to make it read-only and click Properties.


Step 2: Select General tab and look for Read-only check-box.

Step 3: Check Read-only box and click OK.


This way you can avoid unintentional or unauthorized changes in files.

Wednesday, 20 March 2019

How to enable hidden administrator account


This step-by-step article describes how to enable the built-in administrator account.
Method 1: Using Command Prompt
To enable the built-in administrator account, follow these steps:
Step1: Click Start, type cmd in the Start Search box. In the search results list, right-click Command Prompt, and then click Run as Administrator.
When you are prompted by User Account Control, click Yes.
Step2: At the command prompt, type net user administrator /active:yes, and then press Enter.
Step 3: Type net user administrator <actaulPassword>, and then press Enter.
Step 4: Close Command Prompt.
Step 5: Log off the current user account and you will be able to login using administrator account.


Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Tuesday, 19 March 2019

C program to swap two numbers using bit-wise XOR (method 3)

Swapping is used in sorting algorithms like in bubble sort,that is when we wish to arrange numbers in a particular order either in ascending order or in descending order.
Problem:
Given two numbers num1=a and num2=b, task is exchange values of these numbers i.e num1=b and num2=a;

Method 3: Using bit-wise XOR
#include<stdio.h>
int main(){
    int num1=10,num2=20;
    void swapXOR(int,int);  //function prototype
   printf("Values before swapping by call by value:num1=%d,num2=%d.\n",num1,num2);
    swapXOR (num1,num2);    
    return 0;
}
//function definition : using bitwise XOR operator
void swapXOR (int n1,int n2){
  n1 = n1 ^ n2;
  n2 = n1 ^ n2;
  n1 = n1 ^ n2;
  printf("Inside swap3 : num1=%d,num2=%d\n",n1,n2);
}
Output:
Please comment if you find anything incorrect, or you want to improve the topic discussed above.

C program to swap two numbers without using temporary variable(method 2)

Swapping is used in sorting algorithms like in bubble sort,that is when we wish to arrange numbers in a particular order either in ascending order or in descending order.
Problem:
Given two numbers num1=a and num2=b, task is exchange values of these numbers i.e num1=b and num2=a;
Method 2: Without using third variable
#include<stdio.h>
int main(){
    int num1=10,num2=20;
    void swapWithoutTemp (int,int);  //function prototype
   printf("Values before swapping by call by value: num1=%d,num2=%d.\n",num1,num2);
    swapWithoutTemp (num1,num2);     
    return 0;
}
//function definition : without using third variable
void swapWithoutTemp(int n1,int n2){
  n1=n1+n2;
  n2=n1-n2;
  n1=n1-n2;
  printf("Inside swap2 : num1=%d,num2=%d\n",n1,n2);
}


Output:
Please comment if you find anything incorrect, or you want to improve the topic discussed above.

C program to swap two numbers using temporary variable(method 1)

Swapping is used in sorting algorithms like in bubble sort,that is when we wish to arrange numbers in a particular order either in ascending order or in descending order.
Problem:
Given two numbers num1=a and num2=b, task is exchange values of these numbers i.e num1=b and num2=a;
Method 1: Using third variable
#include<stdio.h>
int main(){
    int num1=10,num2=20;
    void swapUsingTemp(int,int);  //function prototype
   printf("Values before swapping by call by value: num1=%d,num2=%d.\n",num1,num2);
    swapUsingTemp (num1,num2);
    return 0;
}
//function definition: using third variable
void swapUsingTemp (int n1,int n2){
  int temp;
  temp=n1;
  n1=n2;
  n2=temp;
  printf("Inside swap1 : num1=%d,num2=%d\n",n1,n2);
}
Output:
Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Wednesday, 13 March 2019

Adobe Placement Paper 2

Engineering Round:(15 questions)

1 Finding height of binary tree
2. Number of times multiplication is required:
int computeXn(int x int n)
{
if(n%2=0)
{
return x*x;
}
else if(n%2=0)
{
int y computeXn(x n/2);
return y*y;
}
else if(n%2=1)
{
int y computeXn(x n/2);
return y*y*x;
}
}
Calculating power of a tree for 5^12.

3. Polynomial A+Bx+Cx^2+....+Nx^(n-1) this representation is more suitable for which data structure. Then P and Q are two such polynomial and how to add that two using that data structure. WAP for that.

4. Specification of variables in one language: letter follow by letter or digit.
options:
1. (LUD)*
2. L.(LUD)* => this one right.
3. L.(L.D)+
4. L.(L.D)*
5.


C Round:(10 questions)

1. Diff between typedef and #define?

2. getbis function gives n bits from the position p of an binary no A.

3. You have to sort large data. But your memory does not have so much space. how you can sort that.

4. a[2][3][4] pointer representation

5. You have two threads T1 and T2 they are reader and writer respectively.
With some specification:
ADDNEW.Process
PROCESS.SET
PROCESS.RESET
ENTER CS
EXIT CS
LOOP
EXIT LOOP
WAIT# PROCESS

6. sprintf() function used how and what means?

7.An array given Arr[] which is in decreasing order. How many swapping required in
for(int index=0;index
{
for(int j=n-index;j
{
if(a[j]>a[j+1])
{
swap(a[j],a[j+1]);
}
}
}

8. Finding Output:
int arr[]={10,20,30,40}
int varible_ptr=arr[0];
for(int index=0;index<4;index++)
{
printf(" arr[%d] = %d", index, *(varible_ptr+index));
varible_ptr+=sizeof(int);
}

Thanks to Pramod Tiwari

Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Infogain Placement Paper 1- 2012


Hi Friends,
I have appeared Infogain interview test. Below i share my experience with you.
There were 3 rounds.
1) Written(Objective: Aptitude+OOPS+RDBMS+file storage system+programming concepts)
2) HR Interview
3) Technical Interview

Written:(Aptitude+Technical)
Time: 1 hour
Questions: 30+30 (+1 for correct answer and no negative marking). Aptitude questions were very simple. Even a 10 class student can score 30 out of 30. Technical questions are as follows: don't remember complete questions but i will write only topic name.

1) Far pointer concept

2) Little endian and big endian coversion

3) Bit wise ANDing, ORing

4) Can a structure be declared in void main()

5) Tree traversing: Infix was given and had to convert to prefix

6) Virtual functions

7) Inheritence and types in Java

8) Can constructors be overloaded?

9) Arrange in ascending oreder: bit, field, byte, record, file(or table), database

10) Surrogate key

11) Primary key

12) Direct memory access

13) How to find structure size without using sizeof() operator?

14) Quick sort concept

15) Quick sort complexity

16) Merge sort complexity

17) Merge sort is the technique which requires extra space.

18) Types of SQL commands:

19) Which of the following can be used as a filter. 

(a) Select (b) Where (c) Group by (d) Having

20) sql command

21) Immediate addressing(from micrprocessors)

22) Encapsulation

23)Difference between multicasting the event and unicasting the event. 


Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Tuesday, 12 March 2019

Adobe Placement Paper 1 (Written Test) - 2011

Following is the written paper consisting of C++ , Engineering questions.
1. void main()
{
char ch1[]=”hello”,ch2[]=”hello”;
if(ch1==ch2)print(“equal”);
else print(“unequal”);
}
predict the output

2. char *p1=”the world is”;
char *p2=”the world is beautiful”;
p1=p2;
p2=”beautiful”;
print(p1);
print(p2);

3. WAP to find whether an arithmetic expression is delimited by proper braces. (matching braces).


4. char ch[16]=”the world is”;
ch[13]=’b’;
print(ch);

5. An array A is given with starting address 5000 .
int A[]={1,2,3,4,5};
print(A+1,&A+1);

6. char * ch1[]={“abcd”,”efgh”,”ijkl”,”mnop”};
char** ch2[]={ch1,ch1+1,ch1+2,ch1+3};
char***ch3;
ch3=ch2;
print(*(*ch3));

Engineering
1. An instruction code of 1 byte(known as bytecode) in JVM is used by a machine. How many (instructions/bytecode) are possible?

2. Multiply 2 no. a and b without the use of * operator recursively. It should not do more no. of additions than the smaller no.

3. Two sets (arrays) A and B are given. Find two no. a and b from A and B respectively such that a+b=val, where val is another input.

4. Check whether a no. is palindrome or not, without converting it to a string or array of any type

5. Reverse a singly linked list.

6. A NxN matrix is given containing only 1’s and 0’s. Every row is sorted in descending order. Find the row containing maximum no. of ones.

7. Numbers ending in 3 have at least one multiple having all ones. for eg., 3 and 13 have a multiples like 111 and 111111 respectively. Given such a no. , find the smallest such multiple of that number. The multiple can exceed the range of int, long. You cannot use any complex data structure.

8. Four processes of 1gb,1.2gb,2gb,2gb are there and RAM available is 2gb. We have a time shared system. Which of the following is the most appropriate scheduling algorithm?
   a. all processes are loaded sequentially 1 by 1
   b. load one process at a time and execute processes in RR fashion
   c. load 1gb, 1,2gb first then processes 3 and 4 follow
   d. All processes can be loaded together and CPU time shared among them

9. if (lock)
      wait
   else
      lock=1
    CS
    lock=0
     a. No issues
     b. works only for uniprocessor systems
     c. data insufficient
     d. won’t work on any system

Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Monday, 11 March 2019

C program to find number of words or tokens in a string

Following program returns the number of words contained in a string.Suppose, we have a string str="Computer Science & Engineering",functions return 4.

#include<stdio.h>
int main(void)
{
  char str[]="Computer Science & Engineering";
  int t=1,i,n=0;
  i=0;
  while(str[i]!='\0')
  {
      if(i==0)
      while(str[i]==' ')
           i++;
      if(str[i]==' ')
        t++;
    while(str[i]==' ')
         i++;
       i++;
  }
  printf("\nTokens=%d\n",t);
  return 0;
}

Output:

Please comment if you find anything incorrect, or you want to improve the topic discussed above.

Sunday, 10 March 2019

C program to copy last n characters a string to another string

This function copies the last n characters of a string to another string. For example, suppose string1 contains "Computer Science" ,then copying last 5 characters of string1 will make string to contain "ience".

#include<stdio.h>
#include<string.h>
void strncopylast(char *str1,char *str2,int n)
{   int i;
    int l=strlen(str1);
    if(n>l)
    {
        printf("\nCan't extract more characters from a smaller string.\n");
        exit(1);
    }
    for(i=0;i<l-n;i++)
         str1++;
    for(i=l-n;i<l;i++)
    {
        *str2=*str1;
         str1++;
         str2++;
    }
    *str2='\0';
}
int main()
{
    char str1[]="Computer Science & Engineering";
    char str2[50];
    int n;
    printf("\nEnter number of character to be copied?");
    scanf("%d",&n);
    strncopylast(str1,str2,n);
    printf("str2=");
    puts(str2);
    return 0;
}
Output:

Please comment if you find anything incorrect, or you want to improve the topic discussed above.