kaustubh deshmukh
BAN USER
- 0of 0 votes
AnswersWhat is composite key? How it differs from candidate key?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
TATA Consultancy Services Dev Lead Dev Lead SQL - 0of 0 votes
AnswersHow will you ensure mutual exclusion in Multi-core processors?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Operating System - 0of 0 votes
AnswersHow security is provided to each tab in google chrome? if there are multiple tabs open in Chrome, then how respective request goes in respective tab? (meaning the request of different tabs do not get mixed, how?)
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Security - 0of 0 votes
AnswersHow will you provide security to DB?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Database - 0of 0 votes
AnswersHow will you search efficiently in DB?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Database - 0of 0 votes
Answershow multithreading is achieved in multicore processors?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Operating System - 0of 0 votes
Answershow many threads a process can have?
- kaustubh deshmukh in India| Report Duplicate | Flag | PURGE
Symantec Associate Operating System
3 Answers OS Question
Hey guys, I am newbie in OS. I have got call from Symantec. Can you please help me in OS. and does anyone know the interview pattern / hardness? Which typical questions are asked?
- kaustubh deshmukh September 16, 2012
And I have doubt. Once it was asked that, how many threads a process should have?
Help will be appreciated.| Flag | PURGE
public class Calendar {
public int year;
public int month;
public int day;
public Calendar(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
}
@Override
public String toString() {
return this.day + "/" + this.month + "/" + this.year;
}
public static Calendar copyy(Calendar in) {
return new Calendar(in.year, in.month, in.day);
}
public static void main(String ...args) {
Calendar c1 = new Calendar(2017, 3, 20);
System.out.println(addDays(c1, 4));
c1 = new Calendar(2017, 3, 20);
System.out.println(addDays(c1, 20));
c1 = new Calendar(2017, 12, 31);
System.out.println(addDays(c1, 1));
c1 = new Calendar(2008, 2, 27);
System.out.println(addDays(c1, 2));
c1 = new Calendar(2017, 1, 1);
System.out.println(addDays(c1, 63));
}
//2017 3 20 - 4
//2017 3 20 - 20
//2017 12 31 - 1
//2008 2 27 - 2
//2017 1 1 - 63
static Calendar addDays(Calendar in, int days) {
if (days <= 0) {
return in;
}
int rem = 0;
switch (in.month) {
case 2:
if (isLeapYear(in.year)) {
rem = 29 - in.day;
} else {
rem = 28 - in.day;
}
break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
rem = 31 - in.day;
break;
default:
rem = 30 - in.day;
break;
}
Calendar out = Calendar.copyy(in);
if (rem <= days) {
out.day = 1;
days = days - rem - 1;
if (out.month == 12) {
out.month = 1;
out.year = out.year + 1;
} else {
out.month = out.month + 1;
}
} else {
out.day = out.day + days;
days = 0;
}
return addDays(out, days);
}
static boolean isLeapYear(int year) {
return year % 4 == 0;
}
}
this will not work for negative numbers.
- kaustubh deshmukh June 19, 2014Its easy, answer would be -1. % operator will give you reminder of the operation.
so -7/-2 = 3 and there remains -1 so result is -1.
Sorry to say, but your question is bit unclear..
- kaustubh deshmukh June 19, 2014#include <stdio.h>
#include <string.h>
int toInt(char *value){
int ind = 0, sum = 0, multiplier = 0;
// find the length of value
// or number of characters present in value
if ( value[0] == '-' ){
for(ind=1; value[ind] != '\0'; ind++);
ind--;
while( ind >= 1 ) {
if(multiplier == 0) {
sum = (value[ind] - '0' ) ;
multiplier = 10;
}
else{
sum = sum + (multiplier * (value[ind] - '0' ));
multiplier = multiplier * 10;
}
ind--;
}
return sum*-1;
}
else {
for(ind=0; value[ind] != '\0'; ind++);
ind--;
while( ind >= 0 ) {
if(multiplier == 0) {
sum = (value[ind] - '0' ) ;
multiplier = 10;
}
else{
sum = sum + (multiplier * (value[ind] - '0' ));
multiplier = multiplier * 10;
}
ind--;
}
return sum;
}
}
void main() {
char *value = "6834";
printf("\n\n %d ", toInt(value)); // gives 6834
// works for negative numbers as well.. :)
}
Thank you! :)
- kaustubh deshmukh September 20, 2012SELECT fistname, lastname
FROM employee
limit 3,1
gives 4th row, if you want 8th row then replace 3 by 7
in mysql it can be done in simple way
select salary
from employee
order by salary
desc
limit 3,1
it will give 4th salary, if you want 6th salary then replace 3 by 5
- kaustubh deshmukh September 18, 2012That's the answer I was looking for, HASHING!! But, how hashing is achieved in case of millions of rows?
- kaustubh deshmukh September 18, 2012thanks for info. Can you please tell me, what sandboxing means?? :-P
would be glad if you explain your answer. thanks :-)
No this is wrong. this program gives wrong input fot input "6", it prints just 6 instead of 12. here is new version (with input limitations) :-P
#include<stdio.h>
#include<stdlib.h>
void main(){
int i;
char *str, buff[100];
str="6";
i = atoi(str);
itoa(i,buff,4); //specify here base i.e. 4
printf("%s",buff);
}
#include<stdio.h>
void f(){
int k =1;
printf("%x ",&k)
}
void fun(){
f();
}
int main(){
int i=1;
printf("%x ",&i);
fun();
}
//*** result
fff4 ffea
that means stack is decreasing.
- kaustubh deshmukh October 18, 2017