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
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.
No comments:
Post a Comment