Study Viral (Java Tutorials For Beginners - Step By Step)
  • Home
  • Java Tutorials
    • Core Java
    • Java Swing
    • MS Access JDBC Java Application
  • Facebook Page
  • Programs
    • C Programs
    • C++ Programs
    • Java Programs
    • Python Programs
  • UGC NET
  • Home
  • Java Tutorials
    • Core Java
    • Java Swing
    • MS Access JDBC Java Application
  • Facebook
  • Programs
    • C Programs
    • C++ Programs
    • Java Programs
    • Python Programs
  • UGC NET

Java Swing Retrieve Image From Database (MySQL) as BLOB - StudyViral

 July 29, 2018     BLOB (Binary Large Object), Java MySQL, Java Swing, Java Swing With MySQL Database     No comments   

Java Swing Retrieve Image From Database (MySQL) as BLOB - StudyViral


Java Swing Retrieve Image From Database (MySQL) as BLOB (Binary Large Object) i.e. MySQL BLOB to Netbeans JLabel

This Video helps you to retrieve image from MySQL database.
Note: This video is in continuation of the last video Save Image to Database (MySQL) as BLOB
Link : https://youtu.be/DlnePp3Q6j8

Database connectivity with MySQL (Add "mysql-connector-java-5.1.9.jar" to Project Library)









Email :: info@studyviral.in
Or
Email :: studyviral.in@gmail.com
Website:: www.StudyViraL.in
Facebook Page ::  https://www.facebook.com/StudyViral.in/
For Suggestions You Can Email :: info@studyviral.in
http://studyviral.blogspot.in/
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Swing - Save Image to Database (MySQL) as BLOB - StudyViral

 July 28, 2018     Java MySQL, Java Swing, Java Swing With MySQL Database     2 comments   

Java Swing - Save Image to Database (MySQL) as BLOB - StudyViral

This video helps you to learn how to selecte image and display to JLabel and further save image to database as BLOB in Java JFrame (Java Swing - Save Image to Database (MySQL) as BLOB (Binary Large Object)).

Database connectivity with MySQL (Add "mysql-connector-java-5.1.9.jar" to Project Library)







Email :: info@studyviral.in
Or
Email :: studyviral.in@gmail.com 
Website:: www.StudyViraL.in 
Facebook Page ::  https://www.facebook.com/StudyViral.in/
For Suggestions You Can Email :: info@studyviral.in
http://studyviral.blogspot.in/
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 20)

 July 17, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 20)




Q20. Which of the following statement is /are TRUE ?

P: Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves the internal architecture.

Q: An example of refactoring is adding new features to satisfy a customer requirement discovered after a project is shipped.

(1). P only                                                                 (2). Q only
(3). Both P and Q only                                              (4). Neither P and Q

Answer : (3). Both P and Q only 

Reason : 
Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. The statement is TRUE and given by MartinFowler in Refactoring Improving The Design Of Existing Code.

Refactoring essentially is cleaning up an existing code base to enable changes to be made more efficiently, or to improve the performance of the existing system.  Refactoring usually involves restructuring or rewriting portions of code which are convoluted, difficult to understand, poorly documented or unnecessarily complex.  Refactoring, the engineers argued, is essential to add future features, so developers should be given time to “refactor” existing code– even if it is the only activity in that sprint or release.

So Both the statements are TRUE. 
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 19)

 July 17, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

 UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 19)



Q19. Which of the following in not a key strategy followed by the clean room approach to software development ?

(1). Formal specification                                                        (2). Dynamic verification
(3). Incremental development                                                (4). Statistical testing of the system

Answer :  (2). Dynamic verification

Reason :
Cleanroom software development is a software development philosophy that is based on avoiding software defects by using formal methods of development and a rigorous inspection process. The name ‘Cleanroom’ was derived by analogy with semiconductor fabrication units. In these units (cleanrooms) defects are avoided by manufacturing in an ultra-clean atmosphere. The objective of this approach to software development is zero-defect software.
The Cleanroom approach to software development is based on five key strategies:
  • Formal specification The software to be developed is formally specified. A state-transition model which shows system responses to stimuli is used to express the specification.
  • Incremental development The software is partitioned into increments which are developed and validated separately using the Cleanroom process. These increments are specified, with customer input, at an early stage in the process.
  • Structured programming Only a limited number of control and data abstraction constructs are used. The program development process is a process of stepwise refinement of the specification. A limited number of constructs are used and the aim is to apply correctness-preserving transformations to the specification to create the program code.
  • Static verification The developed software is statically verified using rigorous software inspections. There is no unit or module testing process for code components.
  • Statistical testing of the system The integrated software increment is tested statistically (see Chapter XX), to determine its reliability. These statistical tests are based on an operational profile which is developed in parallel with the system specification.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 18)

 July 17, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 18)



Q18. Reasons to re-engineer a software include :

P  : Allow legacy software to quickly adapt to the changing requirements.
Q : Upgrade to newer technologies/platform/paradigm (for example, object-oriented).
R : Improve software maintainability.
S  : Allow change in the functionality and architecture of the software.

Code:
(1).  P, R and S only                                                          (2).  P and R only  
(3).  P, Q and S only                                                          (4).  P, Q and R only

Answer : (4).  P, Q and R only

Software Re-engineer is a process of software development which is done to improve the maintainability of a software system. Technical Definition: Software Re-engineering is the examination and alteration of a system to reconstitute it in a new form.


The statement P is true because in re-engineering we can quickly adapt new changes which are required for software.
Q statement is also fine because new technology can be added to software by using software re-engineering. For example, changing function-oriented programs into object-oriented programs.
R statement is also true Refactoring is a re-engineering technique that aims at reorganizing a program without changing its behavior. It seeks to improve a program structure and its maintainability.
The statement Q is not included for Software re-engineering, No new functionality is added to the system but it is restructured and reorganized to facilitate future changes



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 17)

 July 17, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 16)
 


Q17. A software design pattern often used to restrict access to an object is ___________ .

(1) Adapter
(2) Decorator
(3) Delegation
(4) Proxy
 
Answer :  (4) Proxy

Reason :

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns.

These design patterns are all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.

  • Adapter
    Match interfaces of different classes
  • Bridge
    Separates an object’s interface from its implementation
  • Composite
    A tree structure of simple and composite objects
  • Decorator
    Add responsibilities to objects dynamically
  • Facade
    A single class that represents an entire subsystem
  • Flyweight
    A fine-grained instance used for efficient sharing 
  • Private Class Data
    Restricts accessor/mutator access
  • Proxy
    An object representing another object 
A Proxy can also be defined as a surrogate. In the real work a cheque or credit card is a proxy for what is in our bank account.  It can be used in place of cash, which is what is needed, and provides a means of accessing that cash when required. And that's exactly what the Proxy pattern does - controls and manage access to the object they are "protecting".

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 16)

 July 16, 2018     Computer Science And Applications Paper-II, Software Engineering, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 16)



Q16. Coupling is a measure of the strength of the interconnections between software modules. Which of the following are correct statements with respect to modules coupling ?

P : Common coupling occurs when one module controls the flow of another module by passing its information on what to do.

Q: In data coupling the complete data structure is passed from one module to another through parameters.

R: Stamp coupling occurs when modules share a composite data structure and use only part of it.

Code:

(1)  P and Q only                                                                  (2)  P and R only
(3)  Q and R only                                                                  (4)  All P, Q and R only

Answer : (3)  Q and R only 

Reason:
Coupling can be applied to many things such as methods (in object oriented design), systems (in systems engineering) and modules (in any kind of organized system including software systems). Coupling is defined as the extent to which a system, subsystem, method or module connects with (depends on) others. In other words, it measures interdependency. It can be measured for a single module or other entity (the extent to which the module/entity can function or be understood without the use of other modules/entities). 

Types of Coupling
Various authors have described systems for identifying types of coupling. One of the most widely used for software and systems is Myers’ classification, which defines seven levels of coupling, from tightest to loosest:
  • Content coupling - modules rely on each others’ internal data or internal organization
  • Common coupling - modules share the same global data
  • External coupling - modules share an externally imposed data format, communication protocol or device interface
  • Control coupling - one module controls the flow of another, such as by passing it a flag or other information
  • Stamp coupling - modules share a composite data structure but use different parts of it
  • Data coupling - modules share data through parameters, such as in a subroutine call
  • Message coupling - modules communicate by passing messages
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 15)

 July 16, 2018     Computer Science And Applications Paper-II, Software Engineering, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 15)



Q15. Match the 5 CMM Maturity levels/CMMI staged representations in List-I with their characterizations in List-II :

       List-I                                          List-II
(a)  Initial(i)  Processes are improved quantitatively and continually.
(b)  Repeatable(ii)  The plan for project comes from a template for plans.
(c)  Defined(iii) The plan uses processes that can be measured quantitatively.
(d)  Managed(iv)  There may not exist a plan or it may be abandoned.
(e)  Optimizing(v)  There's a plan and people stick to it.


Code:

(a)      (b)        (c)      (d)     (e)
(1)      (iv)(v)       (i)      (iii)     (ii)
(2)      (i)       (ii)      (iv)      (v)     (iii)
(3)      (v)     (iv)      (ii)      (iii)     (i)
(4)      (iv)    (v)       (ii)     (iii)      (i)


Answer:  (3)      (v)     (iv)      (ii)      (iii)     (i)

















Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 14)

 July 15, 2018     Computer Science And Applications Paper-II, Software Engineering, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 14)




Q14. A software system crashed 20 times in the year 2017 and for each crash, it took 2 minutes to restart. Approximately, what was the software availability in that year ?

(1).  96.9924%                                                          (2).  97.9924%
(3).  98.9924%                                                          (4).  99.9924%

Answer : (4).  99.9924%

Reason :  We are given with Mean Time To Repair (MTTR) is a basic measure of the maintainability of repairable items. It represents the average time required to repair a failed component or device.
i.e.  MTTR = 2 mins (2 mins to restart after crash)


Mean time between failures (MTBF) is the predicted elapsed time between inherent failures of a mechanical or electronic system, during normal system operation. MTBF can be calculated as the arithmetic mean (average) time between failures of a system.

MTBF  =               Total Running Time in Year                          =        365 x 24 x 60    
                   Number of Times System Crash in a Year                                  20

MTFB  =  26230

Now we need to find Availability of Software in a Year =              MTBF             =         26230      
                                                                                                  MTBF + MTTR               26230 + 2 
                                                                                        
                                                                                         =  0.9999239  =  0.9999239 x 100 %

                                                                                         =  99.99234 %
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 12)

 July 15, 2018     Computer Science And Applications Paper-II, Software Engineering, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 12)



Q12. Match the following in Software Engineering :


                            List-I                                                 List-II
(a)  Product Complexity(i)  Software Requirement Definition
(b)  Structure System Analysis(ii)  Software Design
(c)   Coupling and Cohesion(iii) Validation Technique
(d)   Symbolic Execution(iv)  Software Cost Estimation

Code:

(a)    (b)   (c)   (d)
(1)      (ii)     (iii)    (iv)    (i)
(2)      (iii)     (i)    (iv)    (ii)
(3)      (iv)     (i)    (ii)    (iii)
(4)      (iii)     (iv)    (i)    (ii)


Answer :

(2)      (iii)     (i)    (iv)    (ii)



Reason : 
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 13)

 July 15, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 13)

Q13. Which one of the following is not typically provided by Source Code Management Software ?

(1). Synchronisation                                    (2). Versioning and Revision history
(3). Syntax highlighting                              (4). Project forking


Answer : (1). Synchronisation    

Reason :  
Definition Source Code Management Software :- A component of software configuration management, version control, also known as revision control or source control, is the management of changes to documents, computer programs, large web sites, and other collections of information. This provides end-to-end tractability from requirements to software code. Source Code Preview & Syntax Highlighting.

A project fork, also called a fork or forking, is the creation of a new branch of a software development project that is independent of the existing project. 
A set of files under version control may be branched or forked at a point in time so that, from that time forward, two copies of those files may develop at different speeds or in different ways independently of each other. 

So at last only  Synchronisation (Synchronization) is not   typically provided by Source Code Management Software.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 11)

 July 14, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 11)


Q11. Assume the following regarding the development of a software system P:

  • Estimated line of code of P : 33,480 LOC
  • Average productivity for P : 620 LOC per person-month
  • Number of software developers : 6
  • Average salary of a software developer : ₹ 50,000 per month
If E,D and C are the estimated development effort (in person-months), estimated development time (in months), and estimated development cost (in ₹Lac) respectively, then (E, D, C) = ________.

(1). (48, 8, 24)                      (2). (54, 9, 27)                  (3) (60, 10, 30)             (4) (42, 7, 21)

Answer : (2). (54, 9, 27)

Reason :

We have given with Average Productivity for P = 620 LOC per person-month and we also have 6 Developers.

So  Single person can do 620 LOC
Therefore       6 Developer can do  = 6 x 620 = 3720 LOC in a month
Now we need to calculate time T to complete the Project     

                                          T =            Estimated Line of Code               =     33480     =  9

                                                6 Developers Line of Code per Month           3720

Now we need to calculate cost to complete the project in 9 months with given average salary of  ₹ 50,000 per month.

                                          Cost = 6 x 9 x 50000  = 27,00,000 (27 Lacs)
So Correct answer is option (2).
                                       


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 10)

 July 14, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 10)



Q10. Consider the matrix M =  ⃒  2     0     2 ⃒  representing a set of planet (2D) geometric
                                                  ⃒   0     1     1 ⃒
                                                  ⃒   0     0     1 ⃒
transformations in homogeneous coordinates. Which of the following statements about the matrix M is True ?

(1). M represents first, a scaling of vector (2,1) followed by translation of vector (1,1).
(2). M represents first, a translation of vector (1,1) followed by scaling of vector (2,1).
(3). M represents first, a scaling of vector (3,1) followed by shearing of parameter (-1,1). 
(4). M represents first, a shearing of parameter (-1,1) followed by scaling of vector (3,1).

Answer : (2). M represents first, a translation of vector (1,1) followed by scaling of vector (2,1).
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 9)

 July 14, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 9) 

 Q9. Which of the following statements is/are True regarding the solution to the visibility problem in 3D graphics ?

S1 : The Painter's algorithm sorts polygons by depth  and then paints (scan - converts) each polygon on to the screen starting with the most nearest polygon.

S2 : Backface Culling refers to eliminating geometry with backfacing normals.

Code: 
(1). S1 only                                                                   (2). S2 only
(3). Both S1 and S2                                                      (4). Neither S1 nor S2 
Answer : (2) S2 only
Reason :
For S1 Statement :
The painter's algorithm, also known as a priority fill, is one of the simplest solutions to the visibility problem in 3D computer graphics. The name "painter's algorithm" refers to the technique employed by many painters for painting distant parts of a scene before parts which are nearer thereby covering some areas of distant parts. The painter's algorithm sorts all the polygons in a scene by their depth and then paints them in this order, farthest to closest. It will paint over the parts that are normally not visible which solving the visibility problem at the cost of having painted invisible areas of distant objects. 
So according to above paragraph the option S1 is FALSE.

For S2 Statement :
Backface culling is an important part of how a 3D engine performs visibility checks. Its purpose is to detect polygons that are invisible in a particular scene that is, polygons that face away from the viewer. The process is similar to clipping, which determines if polygons are within the camera's field of view at all, and if not, are not rendered.
Back-face culling is a method in computer graphics programming which determines whether a polygon of a graphical object is visible; if it is not, the polygon is "culled" from rendering process, which increases efficiency by reducing the number of polygons that the hardware has to draw.
The vertices of front-facing polygons wind in a clockwise fashion, so polygons that face away from the camera are in a counter-clockwise order relative to the current view. When back-faces are culled, these polygons are not drawn. 
So according to above paragraph the option S2 is TRUE.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 8)

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 8)

Q8. A graphic display system has a frame buffer that is 640 pixels wide, 480 pixels high and 1-bit of color depth. If the access time for each pixel on the average is 200 nanoseconds, then the refresh rate of the frame buffer is approximately :

(1) 16 frames per second                                                  (2) 19 frames per second
(3) 21 frames per second                                                  (4) 23 frames per second

 Answer: (1) 16 frames per second    

Reason : Here 640 pixel wide is width of screen means vertical line on screen and 480 pixels high is means vertical line on screen.
Now                                 width (w) = 640 px             and                   height (h) = 480 px
                                        Total = 640 x 480 = 307200

                                        Color depth = 1-bit/px
                                        Memory required for total pixel = w x h x Color Depth
                                        Memory required for total pixel = 640 x 480 x 1-bit = 307200

                                       1 pixel takes 200 nano second to refresh
                                       To refresh the whole screen = 640 x 480 x 200 ns = 61440000 nano second
                                     
                                       For 1 nano second =   ____1____  screen
                                                                            61440000
                                                                                                                                                        9
                                      Now Convert nano seconds to second we multiply above value with 10
                                                                                                     9
                                      For 1 nano second =   ____1____  x 10  = 16.2760 = 16 (Approximately)
                                                                            61440000

                                      The above solved values is closed to Option (1).



                                                                                                                             
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 7)

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 7-9)

Q7. Which of the following statement is/are true ?

P: C programming language has a weak type system with static types.
Q: Java programming language has a strong type system with static types.

Code :
(1).  P only                                    (2).  Q only
(3).  Both P and Q only                 (4).  Neither P nor Q

Answer : (3).  Both P and Q only

Reason: Now in this question first of all we should have the knowledge or idea about words
dynamic/static types which means that the type information acquired at run time or compile time.
The static types checked at compile time and dynamic types checked at run time.

Secondly we also need information about weak/strong types means weather language tries to do implicit conversion from one type to another type.
The strong types means No implicit conversion and weak types means implicit conversion is allowed.

What makes a type system weak or strong comes down to a the ways in which the programmer is able to create type errors.

Now the C language is consider as weak typed because a programmer is allowed to cast types. I can add a pointer to a character if I just tell C that they are both integers.
 
           int main () {
             char ch = 'b';
             void *x;
             (int)ch + (int)x;
          }
 
Java has static type casting as well which allows the programmer to, for example, downcast objects. This makes the static type system not sound. But Java has dynamic type checking for just this reason. Yes, Java has dynamic and static type checking. For this reason, however, I think many people would consider Java to be strongly typed.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) Question 5-6

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) Question 5-6



Q5. Given below are three implementations of the swap() function in C++.


(a)(b)(c)
void swap (int a,int b)
{
       int temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(p,q);
}
void swap (int &a,int &b)
{
       int temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(p,q);
}
void swap (int *a,int *b)
{
       int *temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(&p,&q);
}


Which of the following actually swap the contents of the two integer variables p and q ?  

(1). (a) only                    (2).  (b) only               (3).  (c) only                  (4). (b) and  (c) only

 Answer : (2). (b) only

Reason : If we execute option (a) code than that code will only pass the value of p and q to the function swap (i.e. called pass by value) which will not exchange the values of p and q also there is no use of address operator.

If we execute option (b) code than that code will pass address locations of p and q to swap function instead of actual values. Now the temp stores the value of a (i.e. address location of p, e.g. 1000) when temp = a; after that we have a=b; which replaces the value of a with new value of b i.e. address of q, e.g. 1002 and b=temp; again replaces the actual value of b with value temp (i.e. address location of p). When the swap function finishes its execution part with exchange the content of variable p and q because it replaces the address locations.

If we try to execute option (c) than the code will work fine but it will not replace the content of p and q. Here inside the swap function there is only exchange of addresses for pointer variable a and b not for p and q, So there is exchange of contents for p and q.


Q6. In Java which of the following statement is/are true ?

S1 : The 'final' keyword applied to a class definition prevents the class from being extended through derivation.

S2 : A class can only inherit one class but can implement multiple interfaces.

S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.

Code :
(1).  S1 and S2 only                                                (2).  S1 and S3 only
(3).  S2 and S3 only                                                (4).  All of S1,S2 and S3

Answer :  (1).  S1 and S2 only        

Reason : The statement S1 is true, we can not extends a class which having final keyword with class declaration.
The Second statement S2 is also true that Java don't allow us to extend multiple classes at one time but Java allows us to implement multiple interfaces by using implements keyword.

The third statement S3 is false because the ability of a subclass to override a method allows a class to inherit from a superclass and it is called overriding. The overriding method has the same name, number and type of parameters, and return type as the method that it overrides. An overriding method can also return a subtype of the type returned by the overridden method.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 3-4)

 July 08, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 3-4)


Q3. What is the output of the following JAVA program ?

      
       class simple
       {
           public static void main(String []args)
           {
                simple obj = new simple();
                obj.start();
           }
           void start()
           {
                 long [] P ={3,4,5};
                 long []Q = method(P);
                 System.out.print(P[0]+P[1]+P[2]+" : "); 
                 System.out.print(Q[0]+Q[1]+Q[2]+" : ");
           } 
           long [] method(long []R)
           {
                 R[1] = 7;
                 return R;
           }
       }//end of class

    (1) 12:15
    (2) 15:12
    (3) 12:12
    (4) 15:15

Reason : Initially array P as {3,4,5}. When we pass array P to method as method(P); the method function replaces the value of index 1  i.e. 4 with 7. Now new updated array is value {3,7,5}.
This new returned value reflects on both arrays respectively P and Q. Last the print function adds all index location values of  both arrays separately and shows output 15:15.  


Q4. What is the output of following 'C' program? (Assuming little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address.)

1. #include <stdio.h>
2. #include <stdlib.h>/**/
3. int main()
4. {
5.     union saving
6.     {
7.         short int one;
8.         char two[2];
9.     };
10.    union saving m;
11.    m.two[0] = 5;
12.    m.two[1] = 2;
13.    printf("%d, %d, %d\n",m.two[0],m.two[1],m.one);
14.    return 0;
15. }

(1)   5 ,2, 1282
(2)   5 ,2, 52
(3)   5 ,2, 25
(4)   5 ,2, 517 

 Reason : This is one is interesting question in exam. First we have to know about Big-endian and little-endian are terms that describe the order in which a sequence of bytes are stored in computer memory. Big-endian is an order in which the "big end" (most significant value in the sequence) is stored first (at the lowest storage address). Little-endian is an order in which the "little end" (least significant value in the sequence) is stored first. For example, in a big-endian computer, the two bytes required for the hexadecimal number 4E52 would be stored as 4E52 in storage (if 4E is stored at storage address 1000, for example, 52 will be at address 1001). In a little-endian system, it would be stored as 524E (52 at address 1000, 4E at 1001).
Here we have little - endian in our question. In code we have two union members short int one and char two[2]. In line 11,12 we have numeric values 5 and 2 in char array (without single quote '5' and '2'). In line 13 the output also shows result with %d (i.e. represents for numeric values) which is okay for output 5, 2 but how third values came because we did not provided any value to union member short int one. Just suppose binary conversion of
    5 is 00000101 and  2 is 00000010

Lowest Address (1000)Highest Address(1001)
0000010100000010

Now as per question requirement little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address. Therefore

Lowest Address (1000)Highest Address(1001)
0000001000000101
Now 00000010-00000101 convert this to Decimal value

512+0+0+0+0+0+0+4+0+1  = 517 
After converting the combination of both numbers we have 517 at third location and final result 5, 2, 517.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 1-2)

 July 08, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II)
(Question 1-2)

Q1. The definition in an XML document are said to be _____________ when the tagging system and definitions in the DTD are all in compliance.

(1) well-formed
(2) reasonable
(3) valid
(4) logical

Answer : (3)  

Reason : XML Document Type Declaration, commonly known as DTD.
An XML document can be defined as:

  • Well-formed: If the XML document adheres to all the general XML rules such as tags must be properly nested, opening and closing tags must be balanced, and empty tags must end with '/>', then it is called as well-formed.
    OR
  • Valid: An XML document said to be valid when it is not only well-formed, but it also conforms to available DTD that specifies which tags it uses, what attributes those tags can contain, and which tags can occur inside other tags, among other properties.

Q2. Consider the JavaScript Code:

      var y = "12";
      function f(){
           var y ="6";    
           alert(this.y);
           function g(){alert(y);}
           g();
      }
           f(); 


      If  M is the number of alert dialog boxes generated by this JavaScript code and Dl, D2, ...., DM 
        represents the content displayed in each of the M dialog boxes, then :

     (1)   M3; Dl displays "12"; D2 displays "6"; D3 displays "12".
     (2)   M-3; Dl displays "6"; D2 displays "12"; D3 displays "6".
     (3)   M:2; D! displays "6"; D2 displays "12".
     (4)   M:2; Dl displays "12"; D2 displays "6". 

 Answer : (4) 
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Facebook

StudyViral

Labels

Alphabet Pattern Binary Tree BLOB (Binary Large Object) Computer Networks Computer Science And Applications Paper-II Data Structure DBMS Digital Clock Digital Watch Extra Tutorials File Upload Find Age from Date of Birth Graph-Algorithms Java and J2EE web applications JAVA JDK 12 Java Mail API Java MySQL Java Programs Java Programs List Java Servlets Java Swing Java Swing With MySQL Database Java Tutorials JCalender KVS Compuer Science - January 2017 Question Paper MS Access JDBC Java Application Multiuser Login NETBEANS 11 IDE Occurrence of Digits in Number Operation System Pattern Program Reverse of String Sending Email Servlet Servlet Tutorial Software Engineering Star Struts 2 FrameWork Struts 2 Registration Form UGC NET JULY 2018 Windows Commands

Popular Posts

  • Create CON, AUX, NUL name folder and files in Windows - Study Viral
    Create CON, AUX, NUL name folder and files in Windows - Study Viral Most of you may be aware of many MS-DOS commands but still n...
  • UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 26)
    UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 26) Q 26. A binary search tree in which every non-leaf node...
  • Java Swing Application for Sending E-Mail - StudyViral
    Java Swing Application for Sending E-Mail - StudyViral Hello Friends Welcome to StudyViraL Channel In this video I am going...

Categories

  • Alphabet Pattern (13)
  • Binary Tree (2)
  • BLOB (Binary Large Object) (1)
  • Computer Networks (2)
  • Computer Science And Applications Paper-II (40)
  • Data Structure (6)
  • DBMS (1)
  • Digital Clock (1)
  • Digital Watch (1)
  • Extra Tutorials (3)
  • File Upload (1)
  • Find Age from Date of Birth (1)
  • Graph-Algorithms (1)
  • Java and J2EE web applications (3)
  • JAVA JDK 12 (1)
  • Java Mail API (3)
  • Java MySQL (5)
  • Java Programs (44)
  • Java Programs List (3)
  • Java Servlets (3)
  • Java Swing (16)
  • Java Swing With MySQL Database (4)
  • Java Tutorials (37)
  • JCalender (1)
  • KVS Compuer Science - January 2017 Question Paper (6)
  • MS Access JDBC Java Application (6)
  • Multiuser Login (1)
  • NETBEANS 11 IDE (1)
  • Occurrence of Digits in Number (1)
  • Operation System (4)
  • Pattern Program (8)
  • Reverse of String (2)
  • Sending Email (1)
  • Servlet (3)
  • Servlet Tutorial (3)
  • Software Engineering (4)
  • Star (7)
  • Struts 2 FrameWork (2)
  • Struts 2 Registration Form (1)
  • UGC NET JULY 2018 (40)
  • Windows Commands (2)

Pages

  • Java Tutorials
  • ASP.NET (in Hindi)
  • Java Programs List

Blog Archive

  • ►  2021 (3)
    • ►  April 2021 (3)
  • ►  2019 (7)
    • ►  June 2019 (1)
    • ►  May 2019 (2)
    • ►  March 2019 (4)
  • ▼  2018 (111)
    • ►  November 2018 (7)
    • ►  October 2018 (20)
    • ►  September 2018 (10)
    • ►  August 2018 (3)
    • ▼  July 2018 (19)
      • Java Swing Retrieve Image From Database (MySQL) as...
      • Java Swing - Save Image to Database (MySQL) as BLO...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicatio...
      • UGC NET JULY 2018 (Computer Science And Applicati...
    • ►  June 2018 (5)
    • ►  May 2018 (2)
    • ►  April 2018 (3)
    • ►  March 2018 (11)
    • ►  February 2018 (18)
    • ►  January 2018 (13)
  • ►  2017 (36)
    • ►  December 2017 (10)
    • ►  November 2017 (9)
    • ►  October 2017 (7)
    • ►  September 2017 (10)

About Me

Rohit Basra
Hello guys my name Rohit Basra. I love to code and teach java language.
View my complete profile

Followers

Copyright © Study Viral (Java Tutorials For Beginners - Step By Step) | Powered by Blogger